Three years ago I described how you can use SAS Enterprise Guide to send an e-mail message using Gmail as your e-mail provider.
In the article, I mentioned that you can also write SAS programs that send e-mail messages, but at the time you could not reach Gmail using the FILENAME EMAIL method. SAS did not support the security protocols (SSL) that are necessary to use the Gmail SMTP servers.
That has changed with SAS 9.4. Now with the new SSL and STARTTLS options, you can use SAS to communicate directly with providers such as Gmail and Outlook.com.
Update 11SEP2016: My original program doesn't work now that Google requires you to allow "Less secure apps" in order to send e-mail from a non-Google application. To remedy, you first have to enable Less secure apps from your Google account: security caveats apply. Then, you might have more success by using port 587 and the STARTTLS option (instead of port 485 and SSL, as my original example showed). I've updated my code sample to reflect this.
The following example program shows the options you would use for Gmail. Of course, you must specify your own Gmail address for the ID= value. And if you're squeamish about putting your plain-text password in a program, don't forget that you can use PROC PWENCODE to scramble it from prying eyes.
options emailhost= ( "smtp.gmail.com" /* alternate: port=487 SSL */ port=587 STARTTLS auth=plain /* your Gmail address */ id="firstname.lastname@example.org" /* optional: encode PW with PROC PWENCODE */ pw="your_password" ) ; filename myemail EMAIL to="email@example.com" subject="Read SAS blogs"; data _null_; file myemail; put "Dear Friend,"; put "I recommend that you read https://blogs.sas.com "; put "for lots of SAS news and tips."; run; filename myemail clear;
With SAS for Windows, this program should work without additional configuration. If you run SAS on UNIX or z/OS, you also need to specify the SSLCALISTLOC= system option, which tells SAS where to find the digital certificates that are needed for the SSL connection.