BookmarkSubscribeRSS Feed
elwayfan446
Barite | Level 11

Ok, I am so much closer but not quite where I want to be just yet.  Hopefully you guys can see what I am missing.  When I run @Manu_SAS's code It does imbed the data into the email but it loses the original formatting.

 

options 
 emailsys=smtp emailhost= "smtp.host.com";
 
filename myemail EMAIL
  from="myemail@somewhere.com"
  to="anotheremail@somewhere.com" 
  subject="Email Test"
  content_type="text/html";

data _null_;
file myemail;
infile"C:\Users\me\Documents\myimage.html";
input;
put _infile_;
run;

filename myemail clear;

This is how it appears in the email body:

Capture.PNG

Here is what the actual file looks like:

 

Capture2.PNG

 

To try and keep the formatting I tried some different code I found but when the email is sent, a box shows up as if it is a missing image.

 

options 
 emailsys=smtp emailhost= "smtp.host.com";
 
filename myemail EMAIL
  from="myemail@somewhere.com"
  to="anotheremail@somewhere.com" 
  subject="Email Test"
  content_type="text/html";

ods listing close;
ods html body=myemail options(pagebreak="no") style=HTMLBlue rs=none;
data _null_;
ods html text='<img src="C:\Users\me\Documents\myimage.html"></img>';
run;
ods _all_ close;

filename myemail clear;

Capture3.PNG

ChrisHemedinger
Community Manager

Sometimes, the e-mail client can be picky about how it renders HTML in an e-mail message, especially with HTML that relies on CSS for appearance formatting.  I have a process that sends e-mail daily to report on our SAS blogs.  Here's what it looks like in my inbox:

 

email.png

 

If I click on the bar to "view it in a web browser", I see:

 

email2.png

 

If I use our webmail access to my inbox (instead of my local Microsoft Outlook), I see the better-formatted version there.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
elwayfan446
Barite | Level 11

I see.  I guess that could be the case.

 

Any reason why the first block of code embeds it and the second just leaves the "x" like it is missing an image?

elwayfan446
Barite | Level 11

And I guess it could have something to do with us using lotus notes instead of outlook too.

ChrisHemedinger
Community Manager

That second example (with the <img> tag) doesn't make sense to me.  That creates an image reference that points to an html file (odd thing to do), and the html content isn't embedded into your e-mail at all so it's doomed to not resolve for any recipient.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
elwayfan446
Barite | Level 11

Ok, I see.  I found it somewhere in a google search I stumbled upon.  I have sense left the page.  So the way that @Manu_SAS has described it is the proper and only way then?

 

Looks like I might be stuck with what Lotus Notes is giving me in the first example.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 20 replies
  • 4107 views
  • 2 likes
  • 4 in conversation