电子邮件未发送,没有错误[SAS]

时间:2018-06-27 15:04:39

标签: email parameters sas

%let emailUsername =        %scan(&sysparm,1,+);
%let email =                %unquote(%str(&emailUsername.@example.com));
%let sasProgram =           %scan(&sysparm,2,+);
%let todayDate = %sysfunc(today(),MMDDYYS10.);
%let timeNow = %sysfunc(time(),TIMEAMPM.);

FILENAME mail
    EMAIL TO=%unquote(%str(%'&email.%'))
    SUBJECT='SAS Job Complete: &todayDate. on &timeNow.' 
    CONTENT_TYPE="text/html";



DATA _NULL_;
    file mail;
    PUT "<body>";
    PUT "<p>Hello,</p>";
    PUT "<p>This is an email confirming that your SAS program [&sasProgram..sas] has successfully ran and finished.</p>";
    PUT "<p>- Creators of the SAS Program</p>";
    PUT "</body>";
Run;

我试图了解为什么未发送电子邮件。 如果我在其中硬编码电子邮件地址,则可以使用,但是当我通过它传递变量时,则无法使用。关于尝试发送电子邮件的日志文件没有任何错误,因此我认为发送成功。

还有其他我需要做或看的事情吗?

1 个答案:

答案 0 :(得分:0)

这是我所做的,我更改了您的userEmail分配,并且可以正常工作:

%let emailUsername =        psamson6;
%let email =                %unquote(%str(&emailUsername.@gmail.com));
%let sasProgram =           %scan(&sysparm,2,+);
%let todayDate = %sysfunc(today(),MMDDYYS10.);
%let timeNow = %sysfunc(time(),TIMEAMPM.);


FILENAME mail
    EMAIL TO=%unquote(%str(%'&email.%'))
    SUBJECT='SAS Job Complete: &todayDate. on &timeNow.' 
    CONTENT_TYPE="text/html";



DATA _NULL_;
    file mail;
    PUT "<body>";
    PUT "<p>Hello,</p>";
    PUT "<p>This is an email confirming that your SAS program [&sasProgram..sas] has successfully ran and finished.</p>";
    PUT "<p>- Creators of the SAS Program</p>";
    PUT "</body>";
Run;