Page 1 of 1

LC server, tsNetSmtpSync, mimeEncode and ignorance

Posted: Fri Apr 10, 2020 5:55 pm
by LeProfBard
I'm trying to send an email via SMTP on the LC hosting server via a simple .lc script. The script is below, but the server chokes on the "mimeEncode..." command: it doesn't know what to do with it. What am I missing?


put "[correct username]" into tSettings["username"]
put "[correctPW]" into tSettings["password"]

put "This Should be my content" into tBody
put "[oneEmailAddress]" into tSender
put "[AnotherEmailAddress]" into tRecipient
put "Should be my subject line" into tSubject

put "[correctServerAndPortNumber]" into tUrl

mimeEncodeAsMIMEEmail tBody, "[oneEmailAddress]", "[AnotherEmailAddress]", , "My Subject Line"

put tsNetSmtpSync(tURL, tSender, tRecipient, it, tResponseHeaders, tBytes, tSettings) into tResult

if the first word of tResult is "tsneterr:" then
put "Error" && tResult
put "E-mail sent"
end if


Re: LC server, tsNetSmtpSync, mimeEncode and ignorance

Posted: Tue Apr 14, 2020 6:48 pm
by LeProfBard
If anyone is interested, here is the helpful response I got from the LC team--and it works!
So it turns out that the problem with "MimeEncodeAsMimeEmail" is that it's not present by default in LiveCode Server. You need to add the MIME library to the server and start using it... so if you add the line:

start using "...mime[.]livecodescript"

to your script then "MimeEncodeAsMimeEmail" will work from LiveCode Server (this should handle other MIME functions as well).
I placed the 'start using' script just above the call to "MimeEncodeAsMimeEmail" and it worked perfectly!