Hi:
As you discovered, HTML works by using <IMG> tags; this is technically not embedding the image. An <IMG> tag is a pointer to the image location, frequently on a web server.As long as the folks receiving the email have a fast connection, the retrieval of the image from the server should be fairly speedy. However, in this day and age, most mail clients put a "hold" on the downloading of images from a server until the mail recepient explicitly asks for the images to be downloaded. This is due to security reasons
To insert an image into an RTF (or PDF) file, you would use either the PREIMAGE style= attribute in the SAS title, the PREIMAGE in a style template or a PREIMAGE in the table header to insert an image into an RTF document.
When ODS creates the RTF file or PDF file, the image should be embedded into the document.
How you send the mail is a different story. Do you want to send the email as an attachment? If so, you would 1) create your RTF or PDF file and then 2) use the RTF or PDF file name in the ATTACH= option on your FILENAME EMAIL statement.
If you want to write the RTF directly to the body of the email, then you might have to direct the ODS output to the FILENAME EMAIL statement; however, in this instance, you would also need to change the content-type of the mail to RTF as the MIME header. Do keep in mind that many email servers will display the RTF control strings, but will not render the control strings. As it explains in this paper, if you send RTF in the body of an email, you may need to save the RTF to a text file and then open the newly saved RTF file with Word.
Paper Reference:
http://www2.sas.com/proceedings/forum2008/038-2008.pdf
The method shown below worked for me to send either the RTF or the PDF file as an attachment. When I opened the mail and then opened the attachment
on my laptop, I saw the images in the SAS Title area and in the table header area -- for both types of attachment. However, on my iPhone I could only open the PDF attachment, because I do not have a word processor on the iPhone that would read RTF.
cynthia
[pre]
** Method 1: send email with attachment;
ods pdf file='c:\temp\testlogo.pdf';
ods rtf file='c:\temp\testlogo.rtf';
ods escapechar='^';
title '^S={protectspecialchars=off preimage="c:\temp\greencheck.jpg"} Green Check Image';
proc report data=sashelp.class(obs=5) nowd
style(report)={preimage="c:\temp\greencheck.jpg"};
run;
ods _all_ close;
filename doemail email to='xxx.yyy@company.com'
from='zzzzzzzz@cccccc.net'
subject='Testing attach of rtf'
attach='c:\temp\testlogo.rtf';
data _null_;
file doemail;
put 'this is a test with attachment.';
put 'RTF file has image';
run;
filename doemail clear;
filename pdf2mail email to='xxx.yyy@company.com'
from='zzzzzzzz@cccccc.net'
subject='new Testing attach of pdf'
attach='c:\temp\testlogo.pdf';
data _null_;
file pdf2mail;
put 'this is a test with attachment.';
put 'PDF file has image';
put 'is it on the iPhone?';
run;
filename pdf2mail clear;
[/pre]