Page 1 of 1

Sarah's SMTP Library Problems

Posted: Fri Feb 14, 2014 6:02 pm
by johnmiller1950
Greetings All,

I am writing a program that will enable my users to email from within their liveCode app without having to open an email application.

In researching this, I ran onto Sarah's SMTP Library which allows me to do what I want with one problem.

I can send a regular email, but when I attempt to add any kind of attachment, I get an error message.

Sarah is no longer supporting this library, but I was hoping someone else might be familiar with it and be able to offer some help.

Thanks,
John Miller

Re: Sarah's SMTP Library Problems

Posted: Mon Feb 17, 2014 8:52 pm
by Mark
Hi John,

Whenever you write that an error occurs, you should post the exact and complete text of the error. If you do this, maybe I can help. Posting the relevant code of the script that throws the error might help too.

Kind regards,

Mark

Re: Sarah's SMTP Library Problems

Posted: Wed Feb 19, 2014 4:16 pm
by johnmiller1950
Mark,
Oops! I should know better.

I was getting a "bad read" error message stating that a lone CR or LF had been encountered.

I am still wading through Sarah's code to see where these might be introduced to the body of my email,
but in the meantime, I added code that deletes all lone CR & LF characters. This had fixed my
problem.

Thanks for all the good work you do on the forum.

John

Re: Sarah's SMTP Library Problems

Posted: Wed Feb 19, 2014 4:42 pm
by Mark
Thanks, John!

I don't know how you deleted the cr's and lf's but you might do something like

Code: Select all

replace crlf with numToChar(14) in myBody // keep the correct ones
replace lf with cr in myBody // convert all lf's to cr
replace cr with crlf in myBody // convert all lone lf's and cr's to crlf
replace numToChar(14) with crlf in myBody // put back the originals
There are probably more ways to do this, e.g. with regex.

Kind regards,

Mark