It's a little bit scary to hand over your credentials like this:

enter image description here

I would like to know just how secure this process is. Is any way to ensure that mail sent from Mathematica is encrypted in transit and at rest?

Assuming use of Gmail or Yahoo account servers, can anyone provide more details about the security of payloads sent via SendMail[] - from both Mathematica and the beta Mathematica Online, e.g. info regarding PGP, TLS, MFA, etc.


  • I've always been a bit paranoid about using some of the new tools like MailSearch, has anyone lost data or negatively affected their email accounts using these tools (e.g. Names["Mail*"])?
  • A tutorial on connecting to Google Mail securely (with MFA) would be great, but any links, docs, or undocumented notes would be helpful!

1 Answer 1


Computers communicate with each other through protocols. For example, web servers communicate with browsers using HTTP – the Hypertext Transfer Protocol. Another protocol is HTTPS – the Hypertext Transfer Protocol Secure. The latter is encrypted, the former is not.

As such, the safety of the communication is enforced by the protocol of the email server and is not an implementation detail of Mathematica. By the look of this site, it seems that Gmail uses TLS/SSL, which are both safe options. The encryption inherent in these protocols is such that it would be very difficult to decipher the emails in plaintext by intercepting your network traffic.

You can specify that TLS or SSL should be used with the option EncryptionProtocol, which SendMail and MailServerConnect both accept.

Another option related to safety, although there are no instructions for how to use it with anything but Automatic, is ServerAuthentication. The description of this option indicates that Mathematica can verify at least some certificates automatically.

Finally, Mathematica can store your email password locally, and there is a description in the documentation of how this password is protected:

Email credentials can be optionally stored via the "Password" interactive dialog. The credentials are encrypted using keys stored on your computer's hard drive. The encrypted credentials will be transmitted to the Wolfram Cloud and may only be accessed after you have authenticated using your Wolfram ID.

Beyond this, I do not expect any trouble. Mathematica does not store any information regarding your emails as far as I can see.

  • $\begingroup$ thanks this is helpful, do you have any experience with using the MailSearch function? $\endgroup$
    – user5601
    Feb 19, 2019 at 20:05
  • $\begingroup$ @user5601 I do not, unfortunately. $\endgroup$
    – C. E.
    Feb 19, 2019 at 20:06
  • $\begingroup$ What about rich text formatting from mathematica $\endgroup$
    – user5601
    Feb 19, 2019 at 20:16
  • $\begingroup$ @user5601 I haven't tried it but richly formatted emails are written in HTML, so what you do is that you write your text in HTML (using e.g. <b>bold text</b> to make text bold) and then give that HTML to the HTMLBody parameter in SendMail. $\endgroup$
    – C. E.
    Feb 19, 2019 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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