我将图像保存在一个位置。我可以在电子邮件正文中发送图像,我可以在电子邮件正文中发送表格(使用proc打印)。
问题是我无法将图像和表放在电子邮件正文中。
这是我试过的代码
filename report "c:/users/test.html";
filename SEND email to ="*****@****.com"
from="****@****.com"
attach=("/C/users/graph1.png" name="testgraph1" inlined="logo1")
content_type="text/html";
ods html file=report;
proc print data=test;
run;
ods html close;
data _null_;
infile report;
file SEND;
input;
put _infile_;
put "<img src='id:logo1'/>";
run;
答案 0 :(得分:1)
我认为您使用的路径名中存在错误,这应该更好:
attach=("c:\users\graph1.png")
我在这里也找到了一个例子:
第一部分:
options emailsys = SMTP;
options emailhost = my.smtp.server;
filename myemail EMAIL
to=("TO_ADDRESS@domain.com")
from="FROM NAME <from.name@domain.com>"
sender="FROM NAME <from.name@domain.com>"
/*importance="HIGH"*/
subject = "Subject"
type = "text/html"
attach =(
"fullpath\header.png"
);
ods listing close;
第二部分:
ods html
body=myemail
options(pagebreak="no")
style=sasweb rs=none;
/* start ods to html with options, rs=none forces ODS to perform record based output */
title;
ods escapechar="^";
ods html text= '<img src="./header.png" alt="header">';
ods html text= "<p>Blah blah blah,</p>";
ods html text= "<p>Blah blah blah blah ^S={font_style=italic}BLAH^S={}..</p>";
ods html text= "<p>blah <a href='www.blah.com' target='_blank'>www.blah.com</a>.</p>";
ods html text= "<p>^S={font_weight=bold}First Lastname^S={}<br>
Division<br>
Company inc.</p>";
ods _all_ close;
您必须使用proc报告(或简单地使用proc打印)根据您的需要在您的电子邮件中嵌入表格。
...
ods html text = "... next part of my email :";
PROC REPORT DATA=X nowd HEADLINE HEADSKIP
style (report) = {background = white
font_face = "Verdana" font_size = 7pt just=left }
style (column) = {background = white CELLHEIGHT = 2.5%
font_face = "Verdana" font_size = 7pt just=left}
style (header) = {foreground = cx5e2750 font_face="Verdana"
font_size = 8pt just=left
background = white} ;
columns
DATE
TIME
FN
C;
DEFINE DATE / 'Date';
define TIME / 'Time';
define FN / "File Name";
define C / "Run Number";
run;
ods html text = "Have a Great Day.";
...
此致