In versions before 11.2 (and after 9) one could get the current settings as defined in the preferences (Internet & Email -> Mail Settings) with Options[SendMail]. As the options for SendMail have changed, this does now not work anymore. There now are only MailAddressValidation and MailSettings as options, and the latter is meant to hold an association which defines those paramters, but its default value is Automatic and there seems to be no documented way to programmatically access the values that have been set in the preferences.

Does anyone know a possibility to extract those programmatically anyway?


3 Answers 3


Settings are stored at "ApplicationData\SendMail\Preferences\MailSettings.m" and "ApplicationData\SendMail\Preferences\MailSettingsNew.m" under the $UserBaseDirectory.

msp = FileNameJoin[
   , "ApplicationData"
   , "SendMail"
   , "Preferences"
   , "MailSettings.m"

Query["MailSettings", "Server"][Get@msp]

We can access the present settings using an undocumented global variable:


   <| AutoBcc->{},AutoCc->{},EncryptionProtocol->None,FromAddress->None,

This variable will reflect changes made by the user through the Preferences dialog.

  • 1
    $\begingroup$ interesting, it looks like this is just reading the file that rhermans detected via ResourceLocator`Private`getPreferenceFile["SendMail", \ "MailSettings", PreferencesRead]. Interestingly there is also a corresponding file "MailSettingsNew". I think the combination of your answers gives a quite complete picture... $\endgroup$ Commented Sep 20, 2017 at 21:14

Thanks to rhermans and WReach my question is not only answered but it also is clear what is going on:

In version 11.2 the variable ExternalService`MailSettings`$MailSettings will contain the settings as given in the preferences. The source of that information is the file "ApplicationData\SendMail\Preferences\MailSettingsNew.m", while older versions used "ApplicationData\SendMail\Preferences\MailSettings.m" for that purpose.

Looking at the (readprotected) code for ExternalService`MailSettings`$MailSettings shows that it uses ExternalService`MailSettings`LoadMailSettings to load those settings. That does use the functions from the package "ResourceLocator`" to load that file using Get for the filename returned by ResourceLocator`Private`getPreferenceFile["SendMail", "MailSettingsNew", PreferencesRead].

ExternalService`MailSettings`LoadMailSettings will also take care of converting an old settings file to a new one.


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.