Hello Luc, I assume that Mathematica SendMail is failing to send an email through the Gmail server "smtp.gmail.com" with "From" and "UserName" options both set to the same "firstname.lastname@example.org" account and that these failures generate "Subject: Google Account: sign-in attempt blocked" "To: 'email@example.com'" Gmails like that Steve quotes in the post he sent previous to your post. Are these assumptions about your SendMail to Gmail problem correct?
I just retried my example from one month ago and it still works.
Feel free to call me at the number you can discern from the email address above and perhaps I can walk you through it.
Best of luck.
Unfortunately I am not having much luck with SendMail under Mac OSX. I have tried 2 gmail accounts, 1 iCloud account, and created a Yandex.com account just for testing purpose. I have copy-pasted all the examples above that should work. Both gmail accounts have the Less secured enabled. When using the debugger and breaking on messages, it always seem that Java fails to authenticate.
I tried M10 and M9, under Mavericks and Yosemite.
Adding to the mystery, by writing my own SendMail using JavaLink, I am successful in sending emails to those accounts using M10.
Does anyone have any suggestion on what the issue might be?
Earlier this year, 2014, I used SendMail repeatedly for a time consuming program that would send me updates by SMS messaging my phone. I had difficulty sending them from several of my email accounts but by following the examples above, I used gmail with excellent results, viz.:
SendMail["To" -> "firstname.lastname@example.org",
"Subject" -> "data processed.",
"Body" -> "Files are written.",
"From" -> "email@example.com",
"Server" -> "smtp.gmail.com",
"UserName" -> "firstname.lastname@example.org",
"Password" -> Automatic,
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"]
Unfortunately, I just tried it again tonight (Oct. 26th, 2014) and found that gmail doesn't appear to work with this construct any more. I received an email from gmail stating:
We recently blocked a sign-in attempt to your Google Account [email@example.com].
Sign in attempt details
Date & Time: Sunday, October 26, 2014 2:08:06 AM UTC
Location: New Jersey, USA
If this wasn't you
Please review your Account Activity page at https://security.google.com/settings/security/activity to see if anything looks suspicious. Whoever tried to sign in to your account knows your password; we recommend that you change it right away.
If this was you
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards.
To learn more, see https://support.google.com/accounts/answer/6010255.
The Google Accounts team
Following this link (the the correct account) allows one to permit access to Google Mail from "Less Secure Apps."
This is necessary to allow Mathematica to send emails from Gmail.
SendMail["To" -> "firstname.lastname@example.org", "Subject" -> "Ooo am I not clever",
"Body" -> "sending email from Mathematica",
"From" -> "email@example.com", "Server" -> "smtp.mykolab.com",
"UserName" -> "firstname.lastname@example.org", "Password" -> Automatic,
"PortNumber" -> 587, "EncryptionProtocol" -> "StartTLS"]
This still seems to work. Now on M10, OS X 10.9.4