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

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

1 ACCEPTED SOLUTION

Accepted Solutions
sjughent
Obsidian | Level 7

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

6 REPLIES 6
Kurt_Bremser
Super User

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.

sjughent
Obsidian | Level 7
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;

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sjughent
Obsidian | Level 7

Thanks a lot.

I'll try it now.

sjughent
Obsidian | Level 7

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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