SAS using CSSSTYLE and email features together

I am unable to apply CSS styles to the email I am sending as html format. If I save the ODS output to a local file, I can apply the CSS styles.

Can anyone help me on how to pass the CSS styles in the email stage?

Here is the code I used:

FILENAME SETMAIL EMAIL TO=("tester.first@somedomain.com")
         SUBJECT = "This is a test email with applied CSS HTML styles to email " 
         TYPE="text/html" 
         CONTENT_TYPE='text/html' ;
         ODS HTML BODY=setmail
         CSSSTYLE="D:\\myStyles_EMAIL.css";

TITLE "Be focused !! ";      
PROC PRINT DATA=DODEV.RECENT_HIGH_VOL_ORDERS noobs label;
RUN;
ODS HTML CLOSE;
ODS LISTING;

      

Thanks in advance.

+3


source to share


2 answers


proc template; 
    define style styles.MyMail;
    parent= styles.journal; 
    style body /
        fontfamily="Arial, Helvetica, Sans-serif"
        fontsize= 2
        fontweight=medium
        fontwidth=normal
        color=blg
        backgroundcolor=white
        marginleft=8pt
        marginright=8pt;
    style header /
        fontfamily="Arial, Helvetica, Sans-serif"
        fontsize= 4
        fontweight=bold
        fontstyle=roman
        bordercolor=black
        textalign=center
        backgroundcolor=CX00365B
        color=white;
    style Data / 
        fontfamily="Arial, Helvetica, Sans-serif"
        fontweight=medium
        fontsize=2
        fontstyle=roman
        color=black
        backgroundcolor=white;
    style SystemTitle / 
        fontfamily="Arial, Helvetica, Sans-serif"
        fontweight=bold
        fontsize=6
        fontstyle=roman
        textalign=left
        color=white
        backgroundcolor=CX00365B;
    style SystemTitle2 / 
        fontfamily="Arial, Helvetica, Sans-serif"
        fontweight=bold
        fontsize=4
        fontstyle=roman
        textalign=left
        color=white
        backgroundcolor=CX00365B;
    style SystemTitle3 / 
        fontfamily="Arial, Helvetica, Sans-serif"
        fontweight=medium
        fontsize=2
        fontstyle=roman
        textalign=left
        color=black
        backgroundcolor=white;
     end;
run;

%MACRO SEND_EMAIL_NOTIFICATION(); 

%IF &NUM_CONDS > 0 %THEN

     %DO;       
           FILENAME SETMAIL EMAIL TO=( "hhhhhhhh@xyz.com")
                SUBJECT = "Alert: XXXXXXXX" 
                TYPE="text/html" 
           CONTENT_TYPE='text/html';
           ODS html3  BODY=SETMAIL 
           STYLE=MYMAIL;

           TITLE "Some title 1 ";
           TITLE2 As of &RUN_TIME;
           TITLE3 A total of &NUM_XYZz Some titles, since the last report;
           TITLE4 " " ;

           PROC PRINT DATA=DEV.RECENT_DS noobs label;
           RUN;
           ODS HTML3 CLOSE;
           ODS LISTING;
     %END;
%MEND;

%SEND_EMAIL_NOTIFICATION();

      



Finally, I fulfilled the requirement by creating my own style. Instead of using CSSSTYLE. Not sure how to get CSSSTYLE to work. I think the .msg and .html results are causing the problem.

+1


source


Try to use ODS HTML3

. This embeds style information directly into HTML elements, so no CSS is used for rendering (all style information is specified repeatedly and explicitly within each HTML tag).

This ODS destination is great for backward compatibility. And seeing that the HTML rendering engine used by Outlook is in fact the MS Word Engine requires a lot of compatibility.

Here's a link to the ODS HTML3 doc: http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/viewer.htm#a002596390.ht

Not all HTML formatting is supported by many email clients. Here are some helpful links to give you a good background on what can and cannot be done, and what is and is not supported:



http://24ways.org/2009/rock-solid-html-emails

http://www.emailology.org

http://www.campaignmonitor.com/css/

HTML address alignment by email

0


source







All Articles