SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 19767: Using SAS® software to send SMTP email

DetailsAboutRate It

Follow the steps in this note to send SMTP email with SAS software.

Before beginning the steps, ensure that you have an SMTP email server that you can access.

Use an OPTIONS statement like the following:

options emailsys=smtp emailhost=your.smtpemail.server.com emailport=25;

In this statement, emailhost is the SMTP server specific to your site. Check with your email administrator to determine the correct SMTP email server name. Port 25 is the most common, but check with your email administrator to verify the correct value.

To reveal the status of the email options in the SAS log, submit the following:

proc options group=email;
run;

Alternatively, make the following edits to your config (SASv9.CFG) file:

-emailsys SMTP
-emailhost your.smtpemail.server.com
-emailport 25

You can determine the location of your config file by submitting the code below:

proc options option=config;
run;

The sample code below emails very simple text from a DATA _NULL_ step:

 filename mymail email "your.emailaddress.com_or_edu" subject="test message";
 data _null_;
    file mymail;
    put 'Hello there';
 run; 

When you use SMTP email, you are bypassing any local email client on your machine. SAS is sending email directly to the SMTP server. If you need to stop using SMTP email with SAS so that SAS can send email with your local email client (such as Lotus Notes or Outlook), remove or comment out the email options added to the configuration file used for SMTP.

For troubleshooting steps to follow when you cannot successfully send SMTP email from SAS, see SAS KB0036202 "Troubleshooting guidelines for successfully sending an SMTP e-mail from SAS® software."



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASMicrosoft Windows Server 2012 Datacenter
Microsoft Windows XP Professional
Microsoft Windows Server 2012 Std
Microsoft Windows Server 2012 R2 Std
Microsoft Windows Server 2012 R2 Datacenter
Microsoft Windows Server 2003 for x64
Microsoft Windows Server 2008
Microsoft Windows Server 2008 R2
Microsoft Windows Server 2008 for x64
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows NT Workstation
Microsoft Windows 2000 Professional
Microsoft Windows 2000 Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Advanced Server
Microsoft Windows 95/98
Microsoft Windows 10
Microsoft Windows 8.1 Pro x64
Microsoft Windows 8.1 Pro 32-bit
Microsoft Windows 8.1 Enterprise x64
Microsoft Windows 8.1 Enterprise 32-bit
Microsoft Windows 8 Pro x64
Microsoft Windows 8 Pro 32-bit
Microsoft Windows 8 Enterprise x64
Microsoft Windows 8 Enterprise 32-bit
OS/2
Microsoft® Windows® for x64
Microsoft Windows XP 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft® Windows® for 64-Bit Itanium-based Systems
Macintosh
OpenVMS VAX
z/OS 64-bit
z/OS
Windows 7 Enterprise 32 bit
Windows 7 Enterprise x64
Windows 7 Home Premium 32 bit
Windows 7 Home Premium x64
Windows 7 Professional 32 bit
Windows 7 Professional x64
Windows 7 Ultimate 32 bit
Windows 7 Ultimate x64
Windows Millennium Edition (Me)
Windows Vista
Windows Vista for x64
64-bit Enabled AIX
64-bit Enabled HP-UX
64-bit Enabled Solaris
ABI+ for Intel Architecture
AIX
HP-UX
HP-UX IPF
IRIX
Linux
Linux for x64
Linux on Itanium
OpenVMS Alpha
OpenVMS on HP Integrity
Solaris
Solaris for x64
Tru64 UNIX
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.