DATA Step, Macro, Functions and more

Email , Embed image and text

Reply
Contributor
Posts: 72

Email , Embed image and text

Does anybody know how to send email which has embeded image with some text in it. I am able to send mail with attachments. But the image which is an attachment not embeded in the body of the email. Can somebody help me.
Frequent Contributor
Posts: 102

Re: Email , Embed image and text

We have a similar need, but our solution might not suit your needs because we could not figure out how to imbed the images in the email message itself. We instead put the images on a web server and then created an HTML document that contained references to these images. The email was then created using a email file with the type='text/html' option and the html was written to it.

filename SendMail email to=("my.customer@overthere.com")
from='joe.shmoe@anywherecom'
type='text/html'
subject="Here is my email";

data outfile;
length line $ 4000;
infile "c:\MyHTMLBaseEmal.html" lrecl=4000 TRUNCOVER;
input line $ 1 - 4000;
run;
data _null;
file SendMail;
set outfile;
put line;
run;

The user gets an email with the images shown inline, but they may need to click something autorizing their email client to download the images. Message was edited by: Curtis Mack
Super Contributor
Super Contributor
Posts: 3,174

Re: Email , Embed image and text

The last reply shows a DATA step approach to "push" the HTML document only -- I don't see where there is any embedded image file being referenced, only the HTML tag file.

Scott Barry
SBBWorks, Inc.
Frequent Contributor
Posts: 102

Re: Email , Embed image and text

Please read my post, I said exactly that. The HTML being sent contains img tags with the "src" pointing to images we have on our web server. The images are not "imbeded" in the email, but they do apear inline in the email message.

For example like I did to get this image to show in this post:


alt="Widget showing MB sales." />

Message was edited by: Curtis Mack Message was edited by: Curtis Mack
Contributor
Posts: 72

Re: Email , Embed image and text

Did you use emailsys as SMTP ?
Frequent Contributor
Posts: 102

Re: Email , Embed image and text

Yes, we have an SMTP passthrough server set up just for generating messages in code like this.
Frequent Contributor
Posts: 102

Re: Email , Embed image and text

We have the following options set when we open SAS:

-emailhost "smtp.nwcsr.com" -emailsys smtp

Of course the url of the smtp server would depend on your environment.
Contributor
Posts: 72

Re: Email , Embed image and text

Thanks for taht. Yes if you dont specify SMTP option then the mail wont support html content type.
Frequent Contributor
Posts: 102

Re: Email , Embed image and text

If anyone has figured out how to imbed the images in the email message from within SAS, I would love to know how. I spent some time on it, and I think it would require understaning how the reference an attachment from within a message, or the use of imbeded MIME encoding, or both. What I offered is a work-around that got the job done for us.
Contributor
Posts: 72

Re: Email , Embed image and text

HI Mark,
According to my discussino with SAS Tech support its not possible with current releases of SAS. They are currently working on possibility of developing it. If this is possible then it will be in the next release of SAS.
Frequent Contributor
Posts: 102

Re: Email , Embed image and text

Thanks, now I won't try to figure it out in my spare time (not that that would ever happen Smiley Happy ).
Contributor
Posts: 72

Re: Email , Embed image and text

Hello,

When I sent email with image as a hyper link my mail shows a message saying you need to download the image and its prevented as part of privacy settings. CAn this be overrruled through program.

Thanks,
Ananda
Frequent Contributor
Posts: 102

Re: Email , Embed image and text

I mentioned that this was a problem with this method. I don't think there is a way around it because it is a security feature of the email client, and it would be a pointless feature if the sender could over-ride it.
Ask a Question
Discussion stats
  • 12 replies
  • 1730 views
  • 0 likes
  • 3 in conversation