The SAS Output Delivery System and reporting techniques

email contains html code as an output

Reply
Contributor
Posts: 29

email contains html code as an output

this is my program 

 

filename ofmail email

to="zzzzz@gmail.com"

subject="sashelp.class";

 

 

ods html body=ofmail style=normal;

proc print data=sashelp.class;

run;

ods html close;

 

output in email looks like below instead of sashelp.class table

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="Generator" content="SAS Software Version 9.4, see www.sas.com"> <meta http-equiv="Content-type" content="text/html; charset=windows-1252"> <title>SAS Output</title> <style type="text/css">

<!--

.aligncontents

{

  background-color: transparent;

  border: 0px solid #000000;

  border-spacing: 0px;

  color: #000000;

  font-family: 'Trebuchet MS', Helvetica, Arial, 'Albany AMT', sans-serif;

  font-size: 12pt;

  font-style: normal;

  font-weight: normal;

  margin: 0px;

  padding: 5px;

  text-align: left;

  vertical-align: middle;

}

.batch

{

  background-color: #FFFFFF;

  border-bottom-width: 1px;

  border-color: #3872AC;

  border-left-width: 2px;

  border-right-width: 1px;

  border-spacing: 0px;

  border-style: solid;

  border-top-width: 2px;

  color: #000000;

  font-family: 'Courier New', Courier, fixed;

  font-size: 9pt;

  font-style: normal;

  font-weight: bold;

.

..

and so on diff weird code.

 

 

why this happening ?

SAS Super FREQ
Posts: 8,820

Re: email contains html code as an output

[ Edited ]

Hi:
The "diff weird code" is exactly what you told ODS to send to your FILENAME OFMAIL file using the EMAIL engine.

ODS HTML created an HTML file, a pure HTML 4 file, as you can see from the <DOCTYPE> at the top of the file. If you want to send this file as an attachment, then you need to use the ATTACH= option in your FILENAME statement and, generally, create the HTML file BEFORE you initiate the email. In this case, the BODY of your mail is created with a DATA step that just says something like here's the report for sashelp.class or something like that and then the receiver of the mail opens/saves the attachment.

If you are allowed by your mail system to send HTML in the body of the mail (something you should check before you try this, since many email systems block sending HTML in an email), then you need to follow a different method, such as adding content_type="text/html" to your FILENAME statement.

See the example code on this Tech Support note for more information http://support.sas.com/kb/23/636.html

cynthia

Contributor
Posts: 29

Re: email contains html code as an output

I tried content_type= as well as type= options but still receiving the same code in output. What else can be done ?

SAS Super FREQ
Posts: 8,820

Re: email contains html code as an output

Hi:
Talk to your mail administrators to see whether you are allowed to use HTML in the body of an email; or send the HTML file as an attachment (or better yet, make a PDF file and use that as an attachment -- most mail systems allow PDF); or open a track with Tech Support.

cynthia
Contributor
Posts: 29

Re: email contains html code as an output

Admin says it is allowed.

 

Ask a Question
Discussion stats
  • 4 replies
  • 261 views
  • 0 likes
  • 2 in conversation