What is sas macro code for sending emails through SAS?

Reply
Contributor
Posts: 52

What is sas macro code for sending emails through SAS?

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,

Trusted Advisor
Posts: 1,301

Re: What is sas macro code for sending emails through SAS?

Super User
Super User
Posts: 7,736

Re: What is sas macro code for sending emails through SAS?

Contributor
Posts: 52

Re: What is sas macro code for sending emails through SAS?

Hi,

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

 

ERROR: Email: The connection was refused

Regards

Trusted Advisor
Posts: 1,301

Re: What is sas macro code for sending emails through SAS?

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

Ask a Question
Discussion stats
  • 4 replies
  • 976 views
  • 0 likes
  • 3 in conversation