Sending smtp email on android device

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jasonltaylorGAhWLs
Posts: 4
Joined: Wed Dec 07, 2011 1:39 pm

Sending smtp email on android device

Post by jasonltaylorGAhWLs » Mon Apr 13, 2020 2:40 pm

Hi
I am using previously posted LCMail code to send an email.
Code includes
-- create the smtp message
put createSmtpMessage(tRecipient, tSender, tSubject, tMessage) into tPostData
-- send email
put tsNetSmtpSync(tURL, tSender, tRecipient, tPostData, tResponseHeaders,tBytes,tSettings) into tResult

The code which includes my username and password for my smtp account works fine when I run my app on my windows development machine but not on my android tablet (it fails to send the email and gives no warning or error message).

I want users to verify they have an NHS email account to gain access to part of my app so I am sending a code to the account they specify which they then copy and paste into an answer field for verification. Clearly I don't want the email to be displayed before it is sent hence my use of smtp. Any advice to get this to work or is there a more elegant way of validating an email address in Livecode that I can use?
Thx
Jason

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Sending smtp email on android device

Post by bangkok » Mon Apr 13, 2020 4:13 pm

Have you tried the new command :

Code: Select all

mimeEncodeAsMIMEEmail pBody,pFrom,pTo,pCc,pSubject,pAttachmentA
?

Anyway.

With LC 9.5.1, Windows 8, stack with just :

Code: Select all

mimeEncodeAsMIMEEmail pBody,pFrom,pTo,pCc,pSubject,pAttachmentA

put tsNetSmtpSync(tURL, tSender, tRecipient, it, tResponseHeaders, tBytes, tSettings) into tResult
 
(with Microsoft office365 as the SMTP server)

Compiled for Android. Then tested on Android 7.1 : success

BUT watchout you need to select "Internet" in the inclusions.

(i think this is strange, but anyway i've discovered that during my tests. Without this inclusion, I reveiced SSL certificate error).

Last but not least, for your app, you might use an API email system like :
http://postmarkapp.com

(transactional email)

jasonltaylorGAhWLs
Posts: 4
Joined: Wed Dec 07, 2011 1:39 pm

Re: Sending smtp email on android device

Post by jasonltaylorGAhWLs » Thu Apr 16, 2020 1:48 pm

Thanks for the reply. I hadn't selected internet on the inclusins although I did select it on the Android setup. Anyway I am up and running. :)

Post Reply

Return to “Android Deployment”