Page 1 of 1

How to use Sarah's SMTP library demo

Posted: Sat Aug 11, 2012 11:00 pm
by Nana
Hi,

i am trying to make an android application that sends email to a specific email address. I want to send emails by pressing one button without opening the user's default email program so revMail is not a good solution. I found that Sarah's SMTP library demo do this but i don't know how to use it. I am very newbie in LiveCode so can someone explain me how to use this demo? I try to put on the server the smtp. gmail. com but it doesn't work. Any help would be appreciate.

Thanks in advance.

Re: How to use Sarah's SMTP library demo

Posted: Sat Aug 11, 2012 11:57 pm
by sturgis
I haven't used Sarah's smtp library but I know it uses sockets, and sockets are not yet available on Android. Meaning until that happens it won't work on android at all. It is possible it could be modified to work with IOS if you build the rresockets external (which is part of the externals building tutorial stuff) but there is no externals sdk for android yet either so you can't roll your own socket external there.

If you have access to a server where you can host a cgi script you can probably post data to the server and have it relay the email for you.

Re: How to use Sarah's SMTP library demo

Posted: Sun Aug 12, 2012 11:08 am
by Nana
How can i do it to send automatically the email by pressing one button on android? Is there any tutorial or an example to help me?

Re: How to use Sarah's SMTP library demo

Posted: Sun Aug 12, 2012 11:55 am
by shaosean
No work on Andriod

Re: How to use Sarah's SMTP library demo

Posted: Sun Aug 12, 2012 1:11 pm
by sturgis
If you have access to a web server you can probably find a pre-built php script that you can use to catch posted data and send the email. The server side I can't help you with. I haven't set up an email form/cgi emailer myself but there are a ton available out there.

To actually get the data to the server look at post in the dicionary. Since libUrlFormData is not yet available for android/ios you need to build your post string by hand.

You will want to end up with a string that looks like this
"to=address@example.com&subject=the subject goes here..." you get the idea.
The main thing is that the item to the left of each = must match what the receiving script is expecting so that it knows what to do with each item.

You will also probably need to not have spaces (or certain special chars) in the string. So for example if you have a variable "tSubject" that contains "this is my subject" you will most likely want to use urlencode() on it.

put urlencode(tSubject) into tSubject This will take the above example of "the subject goes here..." and change it to "the+subject+goes+here..." You will want to decode it on the far end so be aware that it will encode more than just spaces. For what you are doing it is possible that you can get away with ONLY encoding spaces so you could always just use replace (replace space with "[space]" then on the far end put the space back in by replacing [space] in the string.

Once you get a valid post string put together you can
post tMyData to URL "http://whatever.address.com/the/email/script.php" -- the data will be sent, and

Re: How to use Sarah's SMTP library demo

Posted: Sun Aug 12, 2012 3:13 pm
by Nana
Thank you very much sturgis you were very helpful i did it and it work fine. Thank you!