BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am trying to send personalized email which has specific body and unique link to each user. so i have used EMAIL to generate this. Now i have to insert a Logo along with body in my email. I am doing this on mainframe (OS/390).
I don't want to send log as attachment.

I would apprciate if any one let me how to acheive this.
14 REPLIES 14
Cynthia_sas
SAS Super FREQ
Hi:
I'm not sure how you'd do this. If you were sending the mail as HTML, you could put an <IMG> tag with the server location of the image into your mail body, but there's no guarantee that the mail server on the receiving end would 1) use the IMG tag or 2) allow the user to download the logo/image.

If you don't want to send the image as an attachment, then I suspect you also don't want to send the mail as an attachment. I generally send users either a plain text HTML file with a URL that contains the link on the web server to where they can access the file/report OR I send them a plain text file with a PDF or RTF or HTML attachment that contains the full report. If the attached report is in ODS PDF or ODS RTF form, then images used are embedded into the file.

You might want to work with Tech Support to see whether they have any specific email recommendations for the mainframe.

cynthia
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
From what you explain (without revealing your SAS code/program which is most preferred here), it would likely be that you are generating an HTML-formatted EMAIL body, either using your own DATA step code or using SAS ODS HTML related facilities.

Suggest you share the SAS program for further feedback and guidance with coding an HTML IMG tag (footer, header) to resolve your logo image in the SAS-generated HTML output.

By the way, the fact that the EMAIL is being generated on OS/390 (z/OS) is not particularly important regarding interest with including an image rendered in the body.


Scott Barry
SBBWorks, Inc.
Cynthia_sas
SAS Super FREQ
And, just to clarify -- when an HTML file contains an <IMG> tag, the image is NOT embedded in the HTML file; the image is living in another location until the rendering software -- either the browser or the mail client -- goes back to the server and retrieves the image. That is why, in Outlook for example, if you receive an HTML e-mail, you are just as likely to NOT see images until you click the download pictures choice at the top of the mail.

So, if what the original poster wants to do is embed an image directly in the HTML mail being sent, the best he can do is put an IMG tag into the HTML text.

cynthia
deleted_user
Not applicable
I have used following code. I am not sure how to embed HTML IMG tag. Here i am trying to build all emails along with body before sending it to server.

FILENAME mail EMAIL;
DATA _NULL_;
INFILE 'ab.userid.sas.input';
INPUT eno $ 1-8 mailaddress $ 9-38
ename $ 39-55
FILE mail
FROM='abb@ab.com'
REPLYTO='abb@ab.com';
PUT '!EM_TO!' mailaddress;
PUT '!EM_SUBJECT!' 'You got a mail';
PUT 'Dear ' ename;
PUT ' ';
PUT 'this is test. this is test.this is test. this is test.this is tes
this is test. this is test.this is test. this is test.';
PUT ' ';
PUT ' https://www.sas.support.com/forum/id=' eno ;
PUT ' ';
PUT '!EM_SEND!' / '!EM_NEWMSG!';
IF eof THEN PUT '!EM_ABORT!';
RUN;
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Given your code, the EMAIL is straight text, not HTML formatted, so the basic component of the process must be changed to get the receiving EMAIL client to acknowledge the document content as an HTML-formatted document.

Suggest you refer to the SAS-hosted documentation on ODS and EMAIL content, particularly the TYPE= parameter in your FILENAME statement - here is one example:

http://support.sas.com/techsup/technote/ts605.html


Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
i have tried adding HTML as content type replaced all PUT text statements with HTML TEXT=.
now i am getting an error saying no TO= is specified eventhough i am trying to read from input file.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Share your executed SAS code completely revealed in the SAS log output (with error messages), pasted as a post-reply.

Scott Barry
SBBWorks, Inc.

Posting content instructions link below:
http://support.sas.com/forums/thread.jspa?messageID=27609 Message was edited by: sbb
deleted_user
Not applicable
I am adding SASLOG without revealing text.

[pre]
NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.

NOTE: SAS (r) 9.1 (TS1M3)

NOTE: This session is executing on the z/OS V01R09M00 platform.

NOTE: SAS 9.1.3 Service Pack 4

[\pre]
[pre]
FILENAME mail EMAIL;
DATA _NULL_;
INFILE 'ab.userid.SAS.INPUT1';
INPUT eno $ 1-8 mailaddress $ 9-38
weblink $ 39-60 fil 61-80;

FILE mail
FROM='ab@abc.com'
content_type='text/html'
REPLYTO='ab@abc.com';

PUT '!EM_SUBJECT!' 'You got a test mail from NYTD Survey';
PUT '!EM_TO!' mailaddress;


ODS HTML BODY=mail STYLE=sasweb;

ods html text='
mytext
';

[/pre]

WARNING: The quoted string currently being processed has become more than 512 chcharacters long. You may have unbalanced quotation marks.
[pre]
83 PUT '!EM_SEND!' / '!EM_NEWMSG!';
84 IF eof THEN PUT '!EM_ABORT!';
85
86 RUN;
[/pre]

NOTE: Variable none is uninitialized.
NOTE: Variable eof is uninitialized.
NOTE: The infile 'ab.userid.SAS.INPUT1' is:
Dsname=ab.userid.SAS.INPUT1,
Unit=3390,Volume=xxxxx,Disp=SHR,Blksize=80, Lrecl=80,Recfm=FB

ERROR: File is in use, .
ERROR: File is in use, .
ERROR: File is in use, .
NOTE: 0 records were read from the infile 'SS.GUMURVY.SAS.INPUT1'. NOTE: The SAS System stopped processing this step because of errors. NOTE: The DATA statement used 0.08 CPU seconds and 17553K.

NOTE: The address space has used a maximum of 644K below the line and 18660K abo


87 ods html close;
ERROR: No TO= address specified for email.
ERROR: No TO= address specified for email.
ERROR: No TO= address specified for email.

88
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
Cynthia_sas
SAS Super FREQ
Hi:
You have two ODS HTML statements in the middle of your DATA step program. Those statements are in the WRONG place. I believe the quotes from the TEXT= option are messing up your DATA step, as evidenced by the notes in the log.

If you carefully examine the samples of sending EMAIL with SAS, I don't think you will find any examples that show the ODS HTML BODY= invocation statement in the -middle- of a DATA step program.

There are basically several -different- ways to generate email via SAS. These papers and notes outline those methods. Pick ONE method and do not intermix code from the different methods:
http://www2.sas.com/proceedings/forum2008/038-2008.pdf
http://www2.sas.com/proceedings/sugi31/256-31.pdf
http://support.sas.com/kb/23/636.html
http://support.sas.com/kb/6/735.html
http://support.sas.com/kb/19/767.html
http://support.sas.com/kb/18/363.html

cynthia
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You have some serious DATA step processing errors, even before getting to the TO= and other concerns raised by Cynthia. Suggest you want to understand when/why you receive SAS NOTE and ERROR messages, resolve those items, then continue forward.

Always important to share code and log, as you now can see why.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Thank you Cynthia and Scott.
I was messing up things by combining multiple methods in one.
I have gone through documentation and your suggestions to acheive required results.

I have modified my email content type as TEXT/HTML and used PUT statements to create proper HTML tags to create body and text.

For Logo I have used HTML IMG tag, I think it is working. I could not able to see the Image in my test mail, as image is on my desktop but once I have image is on server and proper path is coded user should be able to download.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggestion to OP: unless you have some "variable information" to introduce with the generated EMAIL, I would recommend you consider coding all parameters in the FILENAME statement rather than using the PUT statement approach.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search argument, this topic/post:

generate email html z/os site:sas.com
deleted_user
Not applicable
Scott,
I have some text to send in email along with personalized URL for each user( user emailid & variable part of URL read from input file), so i have used PUT statement approach to build my HTML and body.

are you suggesting any better approach or suggestion is for Other Programmers?

thanks,
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
As you mentioned, the EMAIL body varies for any one recipient, so you will need to generate individual EMAILs are you are doing now with the DATA step approach, rather than sending one EMAIL (body) to multiple recipients as you would typically with an EMAIL client.

Scott Barry
SBBWorks, Inc.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 14 replies
  • 3679 views
  • 0 likes
  • 3 in conversation