sendmail through On-Rev server

Paul Hibbert paul at livecode.org
Thu Nov 20 12:45:41 EST 2014


Ralph,

I did get this working again, I've just re-checked and it is still working fine on Diesel. The one thing that made the biggest difference was changing the .irev file name extension to .lc as David Williams suggested.

My version is modified a bit from the original, but I'd be happy to send you the .lc files if it will help.

Paul

On Nov 19, 2014, at 9:35 PM, Ralph DiMola <rdimola at evergreeninfo.net> wrote:

> Has anyone got this script to work on diesel? The server script just seems
> to crash. No statements after the mail are executed. The return data is
> empty from the web service.
> 
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdimola at evergreeninfo.net
> 
> -----Original Message-----
> From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
> Of Paul Hibbert
> Sent: Sunday, October 26, 2014 12:14 PM
> To: How to use LiveCode
> Subject: Re: sendmail through On-Rev server
> 
> Thanks Christer,
> 
> That's the script I was trying on Diesel, but sadly with no joy.
> 
> Paul
> 
> On Oct 26, 2014, at 1:20 AM, Pyyhtiä Christer <christer at mindcrea.com> wrote:
> 
>> The following script works well - on Tio.  Used it yesterday with no
> problems.  Response was immediate.
>> 
>> I got it from someone at RR.
>> 
>> rgds christer
>> ------
>> 
>> -- mail 
>> --
>> -- Emails the given message to the recipients specified.
>> -- Each address passed can have a name attached in the form "name
> <address>".
>> -- Addresses can be passed as comma separated lists.
>> -- Attachements can be added by passing an array (interger indexed or
> otherwise).
>> -- with each attachment itself being an array.
>> --
>> -- pTo        - The addresses to send the message to
>> -- pSub        - The message subject
>> -- pMsg        - The message body
>> -- pFrom    - The address of the message sender
>> -- pCc        - Any cc addresses
>> -- pBcc        - Any Bcc addresses
>> -- pHtml        - Boolean, if the message is to be sent as html
>> -- pAtts        - Array of all attachments to send, each attachment of the
> form:
>> --                    * name: the name of the attachment
>> --                    * path: the absolute path to the attachment
>> --                    * type: the mime type of the attachment, defaults to
> 
>> --                    application/octet-stream
>> --
>> on mail pTo, pSub, pMsg, pFrom, pCc, pBcc, pHtml, pAtts
>>  local tMsg
>>  -- build the message header, adding the from, to and subject details
>>  -- we also put any cc addresses in here, but not bcc (bcc addresses
> hidden)
>>  put shellEscape(pTo) into pTo
>> -- put (pSub) into pSub
>> 
>>  put "From:" && pFrom & return & "To:" && pTo & return & "Subject:" &&
> pSub & return into tMsg
>>  if pCc is not empty then put "Cc:" && pCc & return after tMsg
>>  -- if there are any attachments, we must send this email as multipart
>>  -- with the message body and each attachment forming a part
>>  -- we do this by specifying the message as multipart and generating a
> unique boundary
>>  if pAtts is an array then
>>      local tBoundary
>>      put "boundary" & the seconds into tBoundary
>>      put "MIME-Version: 1.0" & return & "Content-Type: multipart/mixed;
> boundary=" & \
>>      wrapQ(tBoundary) & return & "--" & tBoundary & return after tMsg
>>  end if
>> 
>>  -- add the actual message body, setting the content type appropriatly
>>  if pHtml is true then
>>      put "Content-Type: text/html;" & return & return after tMsg
>>  else
>>      put "Content-Type: text/plain;" & return & return after tMsg
>>  end if
>>  put pMsg & return after tMsg
>> 
>>  -- add each attachment as a new part of the message, sepearting using 
>>  -- the generated boundary
>>  if pAtts is an array then
>>      put "--" & tBoundary & return after tMsg
>>      repeat for each element tAtt in pAtts
>>          if there is a file tAtt["path"] then
>>              if tAtt["type"] is empty then
>>                  get "application/octet-stream"
>>              else
>>                  get tAtt["type"]
>>              end if
>>              put "Content-Type:" && it & "; name=" & wrapQ(tAtt["name"])
> & ";" & \
>>              return & "Content-Transfer-Encoding: base64;" & return &
> return & \
>>              base64Encode(URL ("binfile:" & tAtt["path"])) & return &
> "--" & \
>>              tBoundary & return after tMsg
>>          end if
>>      end repeat
>>  end if
>> 
>>  -- send the mail by piping the message we have just built to the
> sendmail command
>>  -- we must also send a copy of the message to the bcc addresses
>>  get shell("echo" && wrapQ(tMsg) && "| /usr/sbin/sendmail" &&
> wrapQ(shellEscape(pTo)) && "-f" && wrapQ(shellEscape(pFrom)))
>>  if pBcc is not empty then
>>      get shell("echo" && wrapQ(tMsg) && "| /usr/sbin/sendmail" &&
> wrapQ(shellEscape(pBcc)) && "-f" && wrapQ(shellEscape(pFrom)))
>>  end if
>> end mail
>> 
>> ---
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list