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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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