BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PierreDupuis
Fluorite | Level 6

Hi, 

 

I am wondering if someone could provide help... Now we are using SMTP to send emails and we noticed that user can send email on behalf of somebody else using SAS servers with Display Manager and Enterprise Guide.

 

Code example:

 

* Automatic Parameters:

*;

%let email_to   ="pdupuis@cihi.ca" ;

%let email_from ="Mickey Mouse <MickeyMouse@cihi.ca>";

%let email_cc   ="Mini Mouse <MickeyMouse@cihi.ca>";

 

* Step: Sending log via email:

*;

%macro SendEmail;

               filename outbox email "null" emailsys=smtp from=(&email_from.);

               data  _null_;

                                           file outbox

                                            to=(&email_to.)

                                            cc=(&email_cc.)

                                            subject="Test email"                                           

                                            lrecl=256;

                                            put " ";

                                            put "Hi,";

                                            put " ";

                                            put "This is a test email.";

                                            put " ";                                 

                                            put " ";                                 

                              run;

run;

%mend;

%SendEmail

 

 

We wish to enabled the SMTP authentication but because of our security rules we cannot allow our SAS users to have their password save in their SAS program even though it is encoded using "pwencode" or save using macro variable under a personal location.

 

I asked TS and apparently the only secure way is to use "pwencode" to save the password.  Does anyone figured a way? 

 

Thanks.

 

Pierre.  

 

1 ACCEPTED SOLUTION

Accepted Solutions
Andy547
SAS Employee

Pierre,

      How about asking for the user and password?  I am sure there are better ways using Display Manager.

 

%window info         
  #5 @5 'Please enter your email address:'       
  #5 @40 id 88 attr=underline                
  #7 @5 'Please enter password:'            
  #7 @28 pass 20 attr=underline display=no;           
       
%display info;     

options emailauthprotocol = LOGIN;
options emailpw="&pass";
* Automatic Parameters:
*;
%let email_to   ="Myemail@corp.com" ;
%let email_from ="&id";
%let email_cc   ="Mini Mouse <MickeyMouse@cihi.ca>";

%macro SendEmail;               
               filename outbox email "null" emailsys=smtp from=(&email_from.);
               data  _null_;
                                           file outbox
                                            to=(&email_to.)
                                            cc=(&email_cc.)
                                            subject="Test email"                                           
                                            lrecl=256;
                                            put " ";
                                            put "Hi,";
                                            put " ";
                                            put "This is a test email.";
                                            put " ";                                 
                                            put " ";                                           
                run;
                filename outbox clear;
run;
%mend;
%SendEmail

View solution in original post

1 REPLY 1
Andy547
SAS Employee

Pierre,

      How about asking for the user and password?  I am sure there are better ways using Display Manager.

 

%window info         
  #5 @5 'Please enter your email address:'       
  #5 @40 id 88 attr=underline                
  #7 @5 'Please enter password:'            
  #7 @28 pass 20 attr=underline display=no;           
       
%display info;     

options emailauthprotocol = LOGIN;
options emailpw="&pass";
* Automatic Parameters:
*;
%let email_to   ="Myemail@corp.com" ;
%let email_from ="&id";
%let email_cc   ="Mini Mouse <MickeyMouse@cihi.ca>";

%macro SendEmail;               
               filename outbox email "null" emailsys=smtp from=(&email_from.);
               data  _null_;
                                           file outbox
                                            to=(&email_to.)
                                            cc=(&email_cc.)
                                            subject="Test email"                                           
                                            lrecl=256;
                                            put " ";
                                            put "Hi,";
                                            put " ";
                                            put "This is a test email.";
                                            put " ";                                 
                                            put " ";                                           
                run;
                filename outbox clear;
run;
%mend;
%SendEmail

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2153 views
  • 1 like
  • 2 in conversation