Message Boards Message Boards

1
|
22101 Views
|
12 Replies
|
7 Total Likes
View groups...
Share
Share this post:

SendMail from Mathematica 9 on MacOS 10.9

Posted 12 years ago
Could someone post an example of a SendMail command that works on MacOS 10.9 (Mavericks) with Mathematica 9?
12 Replies
We will mention a few resources and after you try them you could perhaps give details on what exactly did not work out for you.
POSTED BY: EDITORIAL BOARD
Thank you but I had seen these already and a number of other references on this topic, but none were helpful. The original post was intentionally as concise as I could make it but if you are hungry for more:
As your 3rd reference suggested I abandoned using the Apple iCloud mail server from SendMail and tried gmail instead, but with no improvement, using something like this:
 SendMail[
  "To" -> "someone@mac.com", 
  "Subject" -> "Example Message",
  "Body" -> "My text", 
  "From" -> "someone@gmail.com",
  "Server" -> "smtp.gmail.com", 
  "UserName" -> "someone@gmail.com",
  "Password" -> Automatic,
  "PortNumber" -> 587, 
"ServerAuthentication" -> Automatic, 
"EncryptionProtocol" -> "StartTLS"]

Mathematica returns $Failed and the message: "SendMail::msgerr: Mathematica received an unexpected response during message transport."

I don't see anything in the system logs that indicate trouble. An undocumented "verbose" option accepted by SendMail would be nice about now. Needless to say Mathematica is able to pass the internet connectivity test to the Wolfram servers, and this computer is fully functional in regard to mail by standard means. 
The following has worked for me with Gmail, M 9.0.1, OSX 10.9

SendMail["To" -> "somebody@domain.edu", "Subject" -> "Example Message",
"Body" -> "My text", "From" -> "somebody@gmail.com",
"Server" -> "smtp.gmail.com", "UserName" -> "somebody",
"Password" -> Automatic, "PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"]

It looks nearly identical to your version of the command.
Thanks for sharing that. Now the mystery deepens, since as you say, your SendMail command version is essentially identical to mine, and it appears we have the same Mathematica and MAC OS versions. In fact if I use your template exactly (filling in the placeholders) the result is unchanged ($Failed and same message as above). Firewall settings have no effect. 
Christopher, this looks like a specific to your set up problem and we recommend contacting Technical Support Team. Also we a happy to let you know that we have a tutorial on posting published which can explain you how to post more easily, including placing code in designated code blocks so the code will not get corrupted by rich-text formatting applied to regular text in the post. You probably have already seen many people are using those code blocks. How to type up a post: editor tutorial & general tips
POSTED BY: EDITORIAL BOARD
Posted 12 years ago
SendMail["To" -> "ausername@me.com", "Subject" -> "Ooo am I not clever",
"Body" -> "sending email from Mathematica",
"From" -> "anotherusername@mykolab.com", "Server" -> "smtp.mykolab.com",
"UserName" -> "anotherusername@mykolab.com", "Password" -> Automatic,
"PortNumber" -> 587, "EncryptionProtocol" -> "StartTLS"]
POSTED BY: peter lindsay
Posted 11 years ago
SendMail["To" -> "ausername@me.com", "Subject" -> "Ooo am I not clever", 
 "Body" -> "sending email from Mathematica", 
 "From" -> "anotherusername@mykolab.com", "Server" -> "smtp.mykolab.com", 
 "UserName" -> "anotherusername@mykolab.com", "Password" -> Automatic, 
 "PortNumber" -> 587, "EncryptionProtocol" -> "StartTLS"]

This still seems to work. Now on M10, OS X 10.9.4

POSTED BY: peter lindsay

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" -> "7325333286@txt.att.net",  
"Subject" -> "data processed.",   
"Body" -> "Files are written.", 
"From" -> "yourusername@gmail.com",  
"Server" -> "smtp.gmail.com",  
"UserName"  -> "yourusername@gmail.com",  
"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 [myusername@gmail.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. 
Sincerely,
The Google Accounts team

Following this link (the the correct account) allows one to permit access to Google Mail from "Less Secure Apps." viz.: enter image description here

This is necessary to allow Mathematica to send emails from Gmail.

Steve

POSTED BY: Stephen Wilkus

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?

POSTED BY: Luc Barthelet

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. Steve

POSTED BY: Stephen Wilkus

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 "your-name@gmail.com" account and that these failures generate "Subject: Google Account: sign-in attempt blocked" "To: 'your-name@gmail.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?

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 "your-name@gmail.com" account and that these failures generate "Subject: Google Account: sign-in attempt blocked" "To: 'your-name@gmail.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?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract