Best Temp Pass Autoresponder?

Rick Harrison harrison at all-auctions.com
Tue Jul 16 13:23:50 EDT 2019


Hi Alex,

Ok, I tried going back to basics just to see
what I could get to work.

I managed to get the ReverseName function to work fine
all by itself in the server.

Then I tried the command mail shell method all by itself.
It looks like the code is executing, but I receive no email!

I’ve listed the code here to see if you spot anything.

<?lc
put "<br><br>"
put "Just before the shellEscape function"
put "<br><br>"

function shellEscape pText

put "Just Inside the shellEscape function"
put "<br><br>"

put "pText = " & pText
put "<br><br>"

repeat for each char tChar in "\`!$" & quote

replace tChar with "\" & tChar in pText

end repeat

return pText

end shellEscape


put "Just after the shellEscape function"
put "<br><br>"

put "Just before the wrapQ function"
put "<br><br>"

-- wrap quotes around text

function wrapQ pText

put "Just Inside the wrapQ function"
put "<br><br>"

return quote & pText & quote

end wrapQ


put "Just after the wrapQ function"
put "<br><br>"


command mail pTo, pSub, pMsg, pFrom, pCc, pBcc, pHtml, pAtts
   local tMsg
   

   put "Inside command mail"
   put "<br><br>"
   
 
   put "pTo = " & pTo
   put "<br><br>"   
   

   put "pSub = " & pSub
   put "<br><br>"
   

   put "pMsg = " & pMsg
   put "<br><br>"

   put "pFrom = " & pFrom
   put "<br><br>"
   
 
   put "pCc = " & pCc
   put "<br><br>"
   

   put "pBcc = " & pBcc
   put "<br><br>"
   
  
   put "pHtml = " & pHtml
   put "<br><br>"
      

   put "pAtts = " & pAtts
   put "<br><br>"        
                    
  
   -- 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 "From:" && pFrom & return & "To:" && pTo & return & "Subject:" && pSub & \
         return into tMsg    if pCc is not empty then
      put "Cc:" && pCc & return after tMsg
   end if

   -- 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 appropriately
   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, separating 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(shellEscape(tMsg)) && "| /usr/sbin/sendmail" && \
         wrapQ(shellEscape(pTo)) && "-f" && wrapQ(shellEscape(pFrom)))
   if pBcc is not empty then
      get shell("echo" && wrapQ(shellEscape(tMsg)) && "| /usr/sbin/sendmail" && \
            wrapQ(shellEscape(pBcc)) && "-f" && wrapQ(shellEscape(pFrom)))
   end if
   if there is a file "log_mail.txt" then
      put "MAIL sent" && the seconds & CR & \
            "TO:" && pTo & CR & \
            "SUBJ:" && pSub & CR &CR after URL ("file:./log_mail.txt")
   end if
   
   put "<br><br>"
   put "At the end of command mail"   
   put "<br><br>"
   
end mail

--mail pTo, pSub, pMsg, pFrom, pCc, pBcc, pHtml, pAtts

  put "Hello" into pVarEmailMessageBody
  put pVarEmailMessageBody into pMessage
  
  put "harrison at all-auctions.com" into pVarEmailAddressToCustomer
  put "RE: Forgot Password" into pSubject

  put "support at innovative-introductions.com" into pFromAddress
  put "" into pCcAddress
  put "" into pBccAddress
  put false into pHtmlFlag
  put "" into pAttsNoAttachements
  
  mail pVarEmailAddressToCustomer, pSubject, pMessage, pFromAddress, pCcAddress, pBccAddress, pHtmlFlag, pAttsNoAttachements
  

   put "After the mail call"   
   put "<br><br>"

?>

> On Jul 15, 2019, at 9:43 PM, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 
> No, it's definitely not that - I use funciton() all the time on LCServer.
> 
> Try this script and see what it does ... if it doesn't work, then check the version, etc.
> 
> If (when?) it does work, then you can start trying to narrow down. (I'd take the example you gave for reversedName, and put it at the top of the script file, see if that gives an error. If not, keep moving it further down until the error can be seen  :-)
> 
> (Or, if there's nothing too secret - send me your whole script off-list and I'll look at it).
> 
> (I have my copy at kilmelford.com/try.lc9 if you want to see its output.)
> 
> Alex.
> 





More information about the use-livecode mailing list