Do we have to update any setting in the outlook. I can't send the data to the body of the email.
my code :
filename mailtest email to = ("first.last@company.com") subject = "test" type="text/html"; ods html body=mailtest style=default; proc print data = sashelp.class; run; ods html close;
output in body email:
<!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">
<!--
.aftercaption
{
background-color: #E0E0E0;
border-spacing: 0px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
font-style: normal;
font-weight: bold;
padding-top: 4pt;
}
.batch
{
background-color: #D3D3D3;
border: 1px solid #000000;
border-collapse: separate;
border-spacing: 1px;
color: #000000;
font-family: 'SAS Monospace', 'Courier New', Courier, monospace;
font-size: x-small;
font-style: normal;
font-weight: normal;
padding: 7px;
}
.beforecaption
{
background-color: #E0E0E0;
border-spacing: 0px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
Hi Radha009
This works for me. The only difference seems to be the ODS destination.
filename mailbox email
subject="Mysubject"
from="sender@company.com"
to=("sender@company.com")
type="text/html";
ods listing close;
ods MSOffice2K body=mailbox style=HTMLblue;
proc print data=sashelp.class;
run;
ods _all_ close;
ods listing;
Got below in the body email:
<html xmlns:v="urn:schemas-microsoft-com:vml">
<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">
<!--
.aftercaption
{
background-color: #FAFBFE;
border-spacing: 0px;
color: #112277;
font-family: Arial, 'Albany AMT', Helvetica, Helv;
font-size: x-small;
font-style: normal;
font-weight: bold;
padding-top: 4pt;
}
.batch
{
background-color: #FAFBFE;
border: 1px solid #C1C1C1;
border-collapse: separate;
border-spacing: 1px;
color: #000000;
font-family: 'SAS Monospace', 'Courier New', Courier, monospace;
font-size: x-small;
font-style: normal;
font-weight: normal;
padding: 7px;
}
.beforecaption
{
background-color: #FAFBFE;
border-spacing: 0px;
color: #112277;
font-family: Arial, 'Albany AMT', Helvetica, Helv;
font-size: x-small;
font-style: normal;
font-weight: bold;
}
Weird. Your code also works for me. The mail body I get is similar to yours, except for the !doctype, and I don't know if that would cause the body content to be shown as text.
My only other guess is that the problem is in the receiving end. Did you check if html is enabled in your mail program?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"><meta name="Generator" content="SAS Software Version 9.4, see www.sas.com">
<title>SAS Output</title>
<style type="text/css">
<!--
.aftercaption
{
background-color: #E0E0E0;
border-spacing: 0px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
font-style: normal;
font-weight: bold;
padding-top: 4pt;
}
.batch
{
background-color: #D3D3D3;
border: 1px solid #000000;
border-collapse: separate;
border-spacing: 1px;
Any help please- The html email sent is displaying in plain code. Do we have any other option to send the sas report to email?
As attachment?
I tried SAS 9.4 windows PC and SAS 7.1 EG from both sending html email from SAS gets email content as plain html code. Please help me.
- Please let me know do we have any alternate solutions to send email as html report?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.