Hi,
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?
<?lc
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"
tsNetInit
put tsNetSmtpSync(tURL, tSender, tRecipient, it, tResponseHeaders, tBytes, tSettings) into tResult
if the first word of tResult is "tsneterr:" then
put "Error" && tResult
else
put "E-mail sent"
end if
?>
LC server, tsNetSmtpSync, mimeEncode and ignorance
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 17
- Joined: Thu Mar 26, 2020 8:23 pm
-
- Posts: 17
- Joined: Thu Mar 26, 2020 8:23 pm
Re: LC server, tsNetSmtpSync, mimeEncode and ignorance
Hi,
If anyone is interested, here is the helpful response I got from the LC team--and it works!
Le PB
If anyone is interested, here is the helpful response I got from the LC team--and it works!
I placed the 'start using' script just above the call to "MimeEncodeAsMimeEmail" and it worked perfectly!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).
Le PB
Re: LC server, tsNetSmtpSync, mimeEncode and ignorance
I had the same question, with HostM (hosting company with LC Server).
Here is the answer, and it works flawlessly.
First you need to copy onto the server, the "mime.livecodescript" file, that you'll find in
/Extension/com.livecode.library.mime/ directory (on your PC)
Then in the lc file :
Here is the answer, and it works flawlessly.
First you need to copy onto the server, the "mime.livecodescript" file, that you'll find in
/Extension/com.livecode.library.mime/ directory (on your PC)
Then in the lc file :
Code: Select all
tsNetInit
put $_SERVER["PATH_TRANSLATED"] into tScriptFolder
set the itemDel to "/"
delete item -1 of tScriptFolder
set the itemDel to ","
start using (tScriptFolder & "/mime.livecodescript")