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:
Here is what the actual file looks like:
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;
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:
If I click on the bar to "view it in a web browser", I see:
If I use our webmail access to my inbox (instead of my local Microsoft Outlook), I see the better-formatted version there.
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?
And I guess it could have something to do with us using lotus notes instead of outlook too.
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.
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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.