BookmarkSubscribeRSS Feed
dkanand86
Calcite | Level 5

Hi All,

I urgently require a generic sas macro code for sending emails through SAS.

Please provide code and possible solutions to this problem.

Thanks and Regards,

4 REPLIES 4
dkanand86
Calcite | Level 5

Hi,

When i run this above macro code, it gives following error:

 

ERROR: Email: The connection was refused

Regards

FriedEgg
SAS Employee

You need to configure SAS with a valid email system so that it can actually work:

Example of Sending E-Mail Using SMTP

The following examples show how you can send e-mail by using SMTP from a DATA step and how you can send your ODS HTML output as HTML and not as an attachment to your e-mail.

To use SMTP you need an SMTP e-mail server that you can access.

To configure SAS to use SMTP, add these system options to your configuration file:

  • -emailsys SMTP
  • -emailhost your.email.server.com
  • -emailport 25.

Ask your system administrator for the location of your.email.server.com. Port 25 is the most common port.

The following code uses the FILENAME statement and a DATA step to send e-mail:

filename mymail email from="yourid@email.com" to="id1@.emailaddr.com" "id2@emailaddr.com") subject="Put Subject Here" content_type="text/html"; data _null_; file mymail; put 'hello world'; run; quit;

http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#sassession.htm#usi...

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 6033 views
  • 0 likes
  • 3 in conversation