App Passwords required for sending emails via Gmail SMTP server

1,574 views
Skip to first unread message

Dave

unread,
Aug 11, 2022, 3:26:27 PM8/11/22
to DroidScript
Hi All,

Google recently made a change to their SMTP gateway security which prevents the use of a simple email account and password combination.  

To get it to work, you must now enable 2-step verification on the Google account and create an 'App Password' by using this link (while logged into the account) - 


The the following pattern can then be used to send emails from your apps 
(don't forget to obfuscate your app so that others can't see your email details and use it for spamming people) - 

email = app.CreateEmail( "mym...@gmail.com", "my-app-pass" )
email.SetSMTP( "smtp.gmail.com", 465 )
email.SetOnStatus( email_OnStatus )
:
:
email.Send( txtSubj.GetText(), txtMsg.GetText(),
       "mym...@gmail.com", "myfr...@blob.com", attach )



See the "Mail Send" sample for a full example


Reply all
Reply to author
Forward
0 new messages