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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 5597 views
  • 0 likes
  • 3 in conversation