SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Post by Dorian (MJT support) » Mon Apr 29, 2019 11:21 pm

We recently had a customer over at the support desk who just couldn't seem to get Macro Scheduler to send emails via Gmail. Although he was doing everything right, the email never got sent. There were no errors and SMTP_RESULT was always blank - it just didn't work.

Here's the code I gave him, which worked for me (of course using correct login credentials) :

Code: Select all

Let>myMsg=Hello there

Let>mySbj=Here is a message

Let>SMTP_SSL=1
Let>SMTP_PORT=465
Let>SMTP_AUTH=1
Let>[email protected]
Let>SMTP_PASSWORD=p4ssword
Let>SENDMAIL_STATUS=1
Let>SMTPServer=smtp.gmail.com

Let>[email protected]
Let>myname=Dorian Ellis
Let>[email protected]
SMTPSendMail>recipients,%SMTPServer%,me,myname,mySbj,myMsg,
MessageModal>Result of SendMail: %SMTP_RESULT%
After a lot of back and forth, head scratching, and replies that contained the word "nope", we had a Eureka moment. He needed to turn this on :

Allow Less Secure Apps :
https://myaccount.google.com/u/1/lessse ... ageId=none

As soon as he enabled that, it successfully sent emails. Maybe this post will prevent future head-scratching.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Post by Phil Pendlebury » Sat May 27, 2023 10:48 am

Ahh sadly this setting no longer exists in gmail.
Phil Pendlebury - Linktree

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Post by Marcus Tettmar » Sun May 28, 2023 12:13 pm

You should just need to create an app password:

https://myaccount.google.com/apppasswords
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Post by Phil Pendlebury » Mon May 29, 2023 5:50 am

Marcus Tettmar wrote:
Sun May 28, 2023 12:13 pm
You should just need to create an app password:

https://myaccount.google.com/apppasswords
I will give that a try. I did see this when following the help link but was not sure of the procedure. More learning... All good.
Phil Pendlebury - Linktree

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Post by Phil Pendlebury » Mon May 29, 2023 10:26 am

The account I am using does not allow app passwords. But really I need to get the mailto link working instead.

Thanks anyway.
Phil Pendlebury - Linktree

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Post by Phil Pendlebury » Mon May 29, 2023 11:41 am

OK needed to enable 2FA and now it works thank you.
Phil Pendlebury - Linktree

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: SMTPSendMail with Gmail (SOLVED) - enable "Less Secure Apps"

Post by Dorian (MJT support) » Thu Mar 07, 2024 9:48 am

Phil Pendlebury wrote:
Mon May 29, 2023 11:41 am
OK needed to enable 2FA and now it works thank you.
Just adding this for the sake of completion.

How to enable 2FA
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts