Architecting, installing and maintaining your SAS environment

Send Email

Reply
New Contributor
Posts: 2

Send Email

How do I connect the data step creating emails to the outside world?  Running under VMWare.

Trusted Advisor
Posts: 1,137

Re: Send Email

hope this helps

filename mailbox email;

data _null_;

file mailbox to='emailaddress@x.com'

subject='test mail';

put "hello";

run;

thanks,

Jag

Thanks,
Jag
New Contributor
Posts: 2

Re: Send Email

Posted in reply to Jagadishkatam

Sorry I didn't make it clear that I was trying to send from inside SAS University Edition under VMWare.  The code below runs but the email never show up.  How do I connect to an email server outside of SAS?

thanks, Howard

data mails ;
  length mail_id $50. ;
  mail_id = "howard@mayers.org" ;
  output ;
  mail_id = "hr@dba.ws" ;
  output ;
  mail_id = "howard@get90team.com" ;
  output ;
  stop ; 
run ;

proc sort ; by mail_id ; run ;
proc print ; run ; 


%macro send_email ;

filename hm_mail email lrecl=32000 type='text/html' ;

data _null_ ;
set mails END=EOF ;
by mail_id ;
file hm_mail ;

retain numofusers 0 ;
if first.mail_id then do ;
  numofusers=numofusers+1 ;
  If mod(numofusers,300) = 0 then Timer=Sleep(120,1) ;
  put '!EM_TO!' mail_id ;
  put '!EM_SUBJECT!' 'Test Plans have been created.' ;
  put 'The following test plans have been created with you as a tester.' ;
  put '<br>' ;
  end ;

id_link = '<a href="' ||left(strip(id)) || '">' || left(strip(id)) || '</a>' ;
put '<br>' ;
put id_link ;
put '<br>' ;

if last.mail_id then do ;
  put '<br>' ;
  put 'This is a system-generated message. Do not reply to this e-mail.' ;
  put '!EM_SEND!' ;
  put '!EM_NEWMSG!' ;
end ;
if EOF then put '!EM_ABORT!' ;
run ;

%mend send_email ;
%send_email ;

Trusted Advisor
Posts: 1,137

Re: Send Email

i am not sure about it though. But i believe if we do not have the licensed sas version, the email thing does not work. 

Thanks,
Jag
Super User
Posts: 7,809

Re: Send Email

SAS uses the local mail agent to forward mail. You either have ) no working mail agent in the VM, or ) it does not have a valid mail relay configured and therefore the mails end up nowhere.

You can see the SAS configuration in your log when you do proc options; run; Look for options starting with EMAIL.

I don't know if the SAS UE VM can have access to the world outside of its host (your desktop PC). If yes, you might try to configure a valid mail relay (SMTP server) using these options.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 4 replies
  • 588 views
  • 1 like
  • 3 in conversation