BookmarkSubscribeRSS Feed
mmea
Quartz | Level 8

Hi I have this code for an email which includes two sgplots and a proc report table:

ods html close;
ods listing;  

filename sendmail email bcc=("test@ki")  FROM=("test@ki") 
	subject="test &todaysDate." 
	CT="text/html"
	attach=("\\test_&todaysDate..pdf" ct ='pdf')
	attach=("\\test_&todaysDate..pdf" ct ='pdf');

ods html body=sendmail rs=none style=deliveries;

ods noproctitle;
ods noptitle;
title; 


ods html text = '<img src="Figur1_&todaysDate..png""></img>';

proc report data=metode_count missing style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void} ;
	    columns new1 metode,COUNT  ;
	    define new1 /'' group  style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void};
        define metode/'' across style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;
		define count/'' analysis sum style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;;
	run;

ods html text = '<img src="Figur2_&todaysDate..png""></img>';

ods html close;
ods listing; 

But the images wont appear in the email,what am i doing worong here

6 REPLIES 6
Kurt_Bremser
Super User

You only have the image links in the mail body, but the images themselves are nowhere.

If you want the images to be visible in the mail, use the INLINED option within the ATTACH= option of the FILENAME EMAIL statement.

mmea
Quartz | Level 8
ods html close;
ods listing;  

filename sendmail email bcc=("test@ki")  FROM=("test@ki") 
	subject="test &todaysDate." 
	CT="text/html"
	attach=("\\test_&todaysDate..pdf" ct ='pdf')
	attach=("\\test_&todaysDate..pdf" ct ='pdf');
attach=("\\Figure1_&todaysDate..png" ct ='png')
	attach=("\\Figure2_&todaysDate..png" ct ='png');

ods html body=sendmail rs=none style=deliveries;

ods noproctitle;
ods noptitle;
title; 


ods html text = '<img src="Figur1_&todaysDate..png""></img>';

proc report data=metode_count missing style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void} ;
	    columns new1 metode,COUNT  ;
	    define new1 /'' group  style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void};
        define metode/'' across style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;
		define count/'' analysis sum style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;;
	run;

ods html text = '<img src="Figur2_&todaysDate..png""></img>';

ods html close;
ods listing; 

 

 

mmea
Quartz | Level 8

My bad.. it was i typo, in my code. 

Its still dosent work after I run the corrected code.

I will try with the inlined

mmea
Quartz | Level 8

i tried this: 

I worked for miy PNG but not he PDF - how can I show the PDF in the body of my email:


options emailsys=smtp;

filename myemail email 
to="test@sdfi.dk" 
from="dsf@df.dk" 
attach=("F:Figur2_&todaysDate..png" INLINED="logo1")
attach=("F:test.pdf" INLINED="logo2")


subject="D."
content_type="text/html";
 


data _null_;
file myemail;
   put '<IMG src="cid:logo1" >';

  put '<IMG src="cid:logo2">';
 
  
 run;

Kurt_Bremser
Super User

AFAIK, you can't make PDFs visible like a picture. I suggest you use ODS HTML to write your report to the email file reference to make it show in the mail body.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1268 views
  • 0 likes
  • 2 in conversation