Using Gmail to send a message via SAS Enterprise Guide


You can use SAS Enterprise Guide to automate most aspects of queries, analytics, and reporting -- including sending e-mail notifications with the results. In this blog post, I'll show you how you can send these results and use Gmail as your e-mail provider.

First, some background: SAS Enterprise Guide provides two methods for sending e-mail: as a one-off (send an item as e-mail right now) or as a repeated step within your process flow (each time your process flow runs). The two methods use different mechanisms and e-mail protocols. The "one-off" method uses MAPI, which will automate your locally installed e-mail client (most often, that's Microsoft Outlook) and seed it with a new message that has your SAS content as an attachment. Because this MAPI method uses your installed e-mail application, no additional configuration is needed.

The "E-mail as a Step" method uses SMTP, and requires a little bit of extra configuration before you can use it. To use SMTP, you have to supply the values in Tools->Options to tell SAS Enterprise Guide where to find your SMTP host, what account to use, and which security protocol.

Note: this is different from the SMTP e-mail methods that are available in the SAS language. You can write SAS programs that send e-mail on your behalf. Here is a SAS Global Forum paper that describes how. But because Gmail uses a security protocol that the SAS language doesn't support, you can't drive the use of Gmail through SAS programs.

Here's how to set it up. You must be using SAS Enterprise Guide 4.22 or later to see these options.

  1. In SAS Enterprise Guide, choose Tools->Options. In the Options window, select the Administration page at the bottom.
  2. In the E-mail Settings area, provide the following values:
    • Outgoing e-mail server and port: : 587
    • Sender e-mail address:
    • Authentication: SSL/TLS (user ID and password sent via SSL)
    • User Name: youraccount (without the domain)
    • Password: your Gmail account password
  3. Click OK to save the settings.

Here is an example of what the window looks like with the values filled in.

Options for Gmail from SAS Enterprise Guide

That's it. You can select Send To->E-mail As a Step in the Project for almost any type of result within SAS Enterprise Guide, and when that step runs it will use these configuration settings to do the work. If you've got something incorrect, you should see an appropriate error message in the log for the e-mail step.


About Author

Chris Hemedinger

Director, SAS User Engagement

+Chris Hemedinger is the Director of SAS User Engagement, which includes our SAS Communities and SAS User Groups. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies


  1. Hi,

    This is a very useful option for one of my ongoing projects. However, i am still using the SAS Enterprise Guide 4.1. I just wanted to know if there is a similar option/ setting that i would need to reset in order to send the mail using the Email as a Step method in SAS EG 4.1?

    I do see similar options as shown in your example screenshot window. However, i'm not able to enter the port number and choose the authentication type.

    Thanks in advance,

  2. Chris Hemedinger on

    No, there is no similar option in SAS Enterprise Guide 4.1. SAS Enterprise Guide 4.1 also uses SMTP, but does not offer the range of authentication choices that we added into 4.2 and 4.3.

  3. Pingback: How to use Gmail to send a message from a SAS program - The SAS Dummy

  4. Pingback: How to use Gmail to send a message from a SAS program - The SAS Dummy

Back to Top