<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Sending Emails While Not Logged IN in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sending-Emails-While-Not-Logged-IN/m-p/919236#M362080</link>
    <description>&lt;P&gt;The gist of the issues is this. I need to run my SAS programs that send emails on a schedule. I acomplished this through BAT files, SAS script and the Windows task scheduler. I need to improve the program by being able to eliminate hard coded Passwords and UserIDs (Prefix to email).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using Proc PWENCODE I have successfuly placed in my Password was able to feed it into the PWD= option in the OPTIONS EMAILHOST() line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is that i thought i could do the same with my email:&lt;/P&gt;
&lt;P&gt;Proc pwencode in="Test@uni.edu" method=SAS004; Run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This provides me a sting just like it does for the Password. ^^^ %let User=%str({SAS004}*****);&amp;nbsp; ^^^&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I pass the macro into the userid field it does not work. It says that the email server is not available. If i hard code it, or use a macro variable that is not endoded (*%let user=Test@uni.edu; ) it will work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the Proc PWEncode and its subsequesnt uses only apply to options that SAS deems as a "Password"? Can I not Encode any string and resolve it just like a macro variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone passed an encoded string to a filed that isnt a password?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: I found that i can not encode the first part of my email (TEST) and concatenate it to the second half (@uni.edu) because of the timing at which the encoding resolves and that fact that there are quotes keeping it from concatenating. It has to be encoded and resolved all toegether.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc pwencode in="Test@uni.edu" method=sas004;
run;
proc pwencode in="BIGpassWorD" method=sas004;
run;
%include "SAS File That constains";
/********************************************************/
/*%let NET=%str({SAS004}***********);*/
/*%let PWD=%str({SAS004}************);*/
/*********************************************************?
%let User2=Test@uni.edu;

%macro Stats_Email;
options emailsys=smtp;
options emailauthprotocol=login	;
options emailhost=('smtp.office365.com' 
					port=587 
					starttls 
					auth=login 
                                        pwd="&amp;amp;PWD" /* This works */ 
					userid="&amp;amp;NET" /* This does not work*/
					userid=&amp;amp;User2. /* This  works*/
					userid=Test@uni.edu /* This  works*/
					);
filename Mymail  email   
					from='Test@uni.edu'  
					type='TEXT/HTML'
;
data _null_;
  file Mymail  
	subject="SUBJECT"
	to=( &amp;amp;Recipients.  )
	
;
	put 'BODY';

run;
ods html close;

%mend;
%Stats_Email;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 05:04:15 GMT</pubDate>
    <dc:creator>GreyJoy</dc:creator>
    <dc:date>2024-03-07T05:04:15Z</dc:date>
    <item>
      <title>Sending Emails While Not Logged IN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sending-Emails-While-Not-Logged-IN/m-p/919236#M362080</link>
      <description>&lt;P&gt;The gist of the issues is this. I need to run my SAS programs that send emails on a schedule. I acomplished this through BAT files, SAS script and the Windows task scheduler. I need to improve the program by being able to eliminate hard coded Passwords and UserIDs (Prefix to email).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using Proc PWENCODE I have successfuly placed in my Password was able to feed it into the PWD= option in the OPTIONS EMAILHOST() line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is that i thought i could do the same with my email:&lt;/P&gt;
&lt;P&gt;Proc pwencode in="Test@uni.edu" method=SAS004; Run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This provides me a sting just like it does for the Password. ^^^ %let User=%str({SAS004}*****);&amp;nbsp; ^^^&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I pass the macro into the userid field it does not work. It says that the email server is not available. If i hard code it, or use a macro variable that is not endoded (*%let user=Test@uni.edu; ) it will work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the Proc PWEncode and its subsequesnt uses only apply to options that SAS deems as a "Password"? Can I not Encode any string and resolve it just like a macro variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone passed an encoded string to a filed that isnt a password?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: I found that i can not encode the first part of my email (TEST) and concatenate it to the second half (@uni.edu) because of the timing at which the encoding resolves and that fact that there are quotes keeping it from concatenating. It has to be encoded and resolved all toegether.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc pwencode in="Test@uni.edu" method=sas004;
run;
proc pwencode in="BIGpassWorD" method=sas004;
run;
%include "SAS File That constains";
/********************************************************/
/*%let NET=%str({SAS004}***********);*/
/*%let PWD=%str({SAS004}************);*/
/*********************************************************?
%let User2=Test@uni.edu;

%macro Stats_Email;
options emailsys=smtp;
options emailauthprotocol=login	;
options emailhost=('smtp.office365.com' 
					port=587 
					starttls 
					auth=login 
                                        pwd="&amp;amp;PWD" /* This works */ 
					userid="&amp;amp;NET" /* This does not work*/
					userid=&amp;amp;User2. /* This  works*/
					userid=Test@uni.edu /* This  works*/
					);
filename Mymail  email   
					from='Test@uni.edu'  
					type='TEXT/HTML'
;
data _null_;
  file Mymail  
	subject="SUBJECT"
	to=( &amp;amp;Recipients.  )
	
;
	put 'BODY';

run;
ods html close;

%mend;
%Stats_Email;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 05:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sending-Emails-While-Not-Logged-IN/m-p/919236#M362080</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2024-03-07T05:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sending Emails While Not Logged IN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sending-Emails-While-Not-Logged-IN/m-p/919298#M362109</link>
      <description>&lt;P&gt;I think the answer to your key question:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Does the Proc PWEncode and its subsequesnt uses only apply to options that SAS deems as a "Password"? Can I not Encode any string and resolve it just like a macro variable?&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is YES.&amp;nbsp; PWENCODE is for encoding passwords.&amp;nbsp; And when you pass an encoded string to a Password, SAS will decode it for you and everything works.&amp;nbsp; But if SAS does not know it's a password, it will not decode it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not a general purpose tool like macro variable resolution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I encode the string the string sashelp.class I get:&lt;/P&gt;
&lt;PRE&gt;12   proc pwencode in=XXXXXXXXXXXXXXX ;
13   run ;


{SAS002}CF1B9B3C5ADB2411174A853C492D86242B2852DA51F0DCB8
&lt;/PRE&gt;
&lt;P&gt;But I cannot then code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set {SAS002}CF1B9B3C5ADB2411174A853C492D86242B2852DA51F0DCB8 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When the DATA step is compiled, the value won't be decoded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at it now, I can see you might think it would work.&amp;nbsp; They could have designed it so that the string string {SAS002} was a general trigger which means "decode the next value", in the same way that the &amp;amp; is a general trigger to resolve a value.&amp;nbsp; And then you could use it to encode any text that appears in your code.&amp;nbsp; But that is not the way that PWENCODEd values work. They are only decoded when SAS knows the value is a password.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 13:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sending-Emails-While-Not-Logged-IN/m-p/919298#M362109</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-03-07T13:03:03Z</dc:date>
    </item>
  </channel>
</rss>

