Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I can't get my email settings set properly such that I can use SendMail[] to email directly from Mathematica.

I have opened "Preferences", clicked on the tab "Internet Connectivity" and filled in all the settings to match those in my Apple Mail accounts settings.

These include:

  • Server
  • Port Number
  • Encryption Protocol
  • Username
  • From Address
  • Full Name
  • Reply To

Odd that no setting exists for "Password"?

The "Preference" window's "Test Internet Connectivity" tells me "Test succeeded..."

Apple Mail has a setting to "Use default ports (25, 465, 587)" so I thought this might confuse the Mathematica settings, so I've tried setting the Apple Mail settings to "Use Custom Port" and specified each of the the default ports specifically. None of those settings worked either.

I have also attempted to specify all available options for SendMail[] specifically also trying each of the 3 possible "default" ports described above.

 "From" -> "myemail@myisp.com",
 "To" -> "recipientemail@isp.com",
 "Subject" -> "Example Message",
 "Body" -> "Test",
 "Server" -> "smtpout.secureserver.net",
 "EncryptionProtocol" -> "SSL",
 "FullName" -> "MyUserName",
 "Password" -> "myPassword",
 "PortNumber" -> 25 (* I also tried 465, 587 *),
 "ReplyTo" -> None,
 "ServerAuthentication" -> Automatic,
 "UserName" -> "myUserName"

Again SendMail[] gives me the same message: $Failed.

Also, in the "Preferences" window under the "Proxy Settings" tab I have tried selecting both "User proxy settings from my system or browser" and "Direct connection to the Internet".

The "Troubleshooting Internet Connectivity Problems - Wolfram Mathematica" in the "Document Center" suggests checking proxy settings. Given what mine look like in Snow Leopard's "Preferences" >> "Network" >> "Proxies"


I don't think I have much to help.

I have no Firewall Setting on the computer.

This has me stumped.

Does anyone have an idea of what else I can try.

share|improve this question
It works for me on a mac using a gmail account but not using my icloud account. See if you can get it to work using another email server. –  Matariki Jul 14 '12 at 6:13

1 Answer 1

up vote 16 down vote accepted

This might not work for you but is an example to use the Gmail mail server to send emails from a notebook.

The example code overrides all settings in the MMa email preference settings and should work out of the box. NB I have tested this only on my Mac.

 "To" -> "YYY...@me.com",
 "Subject" -> "Example Message",
 "Body" -> "My text",
 "From" -> "xxx...@gmail.com",
 "Server" -> "smtp.gmail.com",
 "UserName" -> "xxx...@gmail.com",
 "Password" -> Automatic,
 "PortNumber" -> 587,
 "EncryptionProtocol" -> "StartTLS"
share|improve this answer
Up voted because today I learned I can automatically email my advisor from within Mathematica. –  user1602 Jul 14 '12 at 10:17
I set up a gmail account and your solution works perfectly. Odd that I couldn't get this to work with any of my other email accounts. My browser, Safari, easily sends emails from my main email account. It seems like that should work with Mathematica. In any event, thanks. –  Jagra Jul 14 '12 at 14:35
@Jagra I have experienced the same problem with my iCloud account which gives me a cannot connect error. Since I use the gmail account. –  Matariki Jul 14 '12 at 20:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.