The SAS Output Delivery System and reporting techniques

how to format text in SAS email body, bulk e-mails via proc import

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

how to format text in SAS email body, bulk e-mails via proc import

[ Edited ]

Hallo,

 

I can't find out how I can format tekst in my email body, that I send by program below.

Some words need to be bold or italic.

I tried ods escapechar='^';, but it doesn't work without ods pdf/rtf

 

Thanks a lot for the respons,

Svetlana


Accepted Solutions
Solution
‎02-06-2018 09:48 AM
Occasional Contributor
Posts: 17

Re: how to format text in SAS email body, bulk e-mails via proc import

[ Edited ]

I read the article and tried to make adjustments to my SAS code. It looks like you need to create the HTML first and then you can send an email as text/html content type. Does it work also with the PUT Statement in STMP e-mail Interfase? All the examples I could find refer to FILENAME statement to send een e-mail. I use my code to send a bulk email and I use en PUT '!EM_XX! directive.

View solution in original post


All Replies
Super User
Posts: 9,551

Re: how to format text in SAS email body, bulk e-mails via proc import

Please post your code in a suitable subwindow (see https://communities.sas.com/t5/help/faqpage/faq-category-id/posting), or as a .sas file attachment.

DO NOT EVER store SAS code in a Word document, as Word (or similar word processors) will do funny things with your code that can cause errors or make it un-runnable.

On top of that, MS Office files are considered dangerous and therefore blocked against download from the 'net by many firewalls.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 17

Re: how to format text in SAS email body, bulk e-mails via proc import

[ Edited ]
PROC IMPORT OUT= WORK.MELIJSTEN 
            DATAFILE= "S:\cpvokug\DMSJ\bulk_mail\1710_laboranten mailing\1710_lijst om mails te versturen.xls" 
            DBMS=xls REPLACE;
     SHEET="Blad1"; 
     GETNAMES=YES;
     RUN;
options emailsys=smtp emailhost=smtp.ugent.be emailid="CvKO.Gent@bevolkingsonderzoek.be" emailport=25;
FILENAME mail EMAIL;
data _null_ ;
FILE mail;
PUT '!EM_TO!' EMAIL_test; * email 'TO' adres, 'email1' verwijst naar variabele in file Lijst_screening;
PUT '!EM_BCC!' EMAILBCC_test; * email 'BCC' adres;
PUT '!EM_FROM!' "Centrum voor Kankeropsporing Afdeling Gent. <CvKO.Gent@bevolkingsonderzoek.be>";
PUT '!EM_REPLYTO!' EMAIL_REPLY;
PUT '!EM_SUBJECT!' 'aanpassen? info laborant ' ; * dit komt in het onderwerp van de mail;
*PUT '!EM_ATTACH!' ATTCH ; * attachment bijvoegen;
* Hieronder de tekst van het emailbericht;
PUT 'Beste,' ;
put;
put 'In Heracles (of bij het opstellen van de xml) moet u aangeven wie de screeningsmammografie genomen heeft. Indien het de eerste lezer zelf is, hoeft u niets extra in te vullen. Als het om een laborant gaat moet u initialen/naam invullen. ';
put;
put 'In bijlage vindt u een lijst waarop alle initialen/namen staan die in 2015-2016 door uw ME zijn ingevuld. Let erop dat éénzelfde letter kan leiden tot twee verschillende namen omdat hoofdletter en een kleine letter een aparte betekenis hebben. ' ;
put 'Bv: MvB is een andere code dan MVB, en bv "dirk" wordt apart gezien van "Dirk". ' ;
put;
put 'Door u te doen:';
put '1) kunt u per initiaal de voornaam van die persoon invullen in de kolom "voornaam", en de achternaam van die persoon invullen in de kolom "achternaam"? Als u het niet weet, noteert u "onbekend".';
put "2) kunt u in de kolom 'actief' een 'x' zetten als die persoon nu of in de nabije toekomst de foto's zal nemen? Het zal in de toekomst namelijk een drop-down veld worden ipv een vrij veld. We zullen de volledige naam van die persoon dan voorzien in Heracles/vragen te voorzien in de xml software. Als u iemand niet terug vindt in de lijst van initialen, dan mag u die helemaal onderaan toevoegen. ";
put '3) de lijst lokaal saven en naar dit email adres terugsturen (als reply, zonder het onderwerp van de email te veranderen),  ten laatste 10/11/17.';
put;
put;
put 'Met vriendelijke groeten,';
put;
put '?wie';
put '?wie';
put 'WWW.BEVOLKINGSONDERZOEK.BE';
put;
put;
put '!EM_SEND!' / '!EM_NEWMSG!';
if eof then put '!EM_ABORT!';
run;

 

Super User
Super User
Posts: 9,193

Re: how to format text in SAS email body, bulk e-mails via proc import

Use HTML:

http://support.sas.com/resources/papers/proceedings10/060-2010.pdf

 

Page 4 of 8 is most helpful.  Please also use the search functionality on the forum before posting, this exact question was asked last week.

Occasional Contributor
Posts: 17

Re: how to format text in SAS email body, bulk e-mails via proc import

Thanks a lot.

I'll try it now.

Solution
‎02-06-2018 09:48 AM
Occasional Contributor
Posts: 17

Re: how to format text in SAS email body, bulk e-mails via proc import

[ Edited ]

I read the article and tried to make adjustments to my SAS code. It looks like you need to create the HTML first and then you can send an email as text/html content type. Does it work also with the PUT Statement in STMP e-mail Interfase? All the examples I could find refer to FILENAME statement to send een e-mail. I use my code to send a bulk email and I use en PUT '!EM_XX! directive.

Super User
Super User
Posts: 9,193

Re: how to format text in SAS email body, bulk e-mails via proc import

I am not clear on what you mean, the code below shows sending a html email, it doesn't generate any code, and uses put statements.  It also uses smtp system.  This is the normal method for sending emails, I have never heard of "PUT '!EM_XX! directive"

 

options emailsys=smtp emailhost=smtp.domain.com;
filename myemail email to="chuck.hunley@sas.com"
                       from="SAS Global Forum <sgf2010@sas.com>"
                       sender="SAS Global Forum <sgf2010@sas.com>"
                       subject="SAS Global Forum"
                       content_type="text/html";
data _null_;
 file myemail;
 put '<html>';
 put '<head>';
 put '<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">';
 put '<title>SAS Global Forum</title>';
 put '</head>';
 put '<body>';
 put '<b>';
 put '<span style="font-size: 12pt;';
 put 'font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;">';
 put '<br>';
 put 'Welcome to SAS® Global Forum!';
 put '<br><br>';
 put '<img id="_x0000_i1025"';
 put 'src="http://www.sas.com/images/partners/2010_SGF_no_button.jpg"';
 put 'height="292" width="160">';
 put '</span>';
 put '</b>';
 put '</body>';
 put '</html>';
run;
filename myemail clear;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 737 views
  • 2 likes
  • 3 in conversation