Sarah's SMTP Library Problems

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Sarah's SMTP Library Problems

Post by johnmiller1950 » Fri Feb 14, 2014 6:02 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Sarah's SMTP Library Problems

Post by Mark » Mon Feb 17, 2014 8:52 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Sarah's SMTP Library Problems

Post by johnmiller1950 » Wed Feb 19, 2014 4:16 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Sarah's SMTP Library Problems

Post by Mark » Wed Feb 19, 2014 4:42 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply