在EMAIL中使用以下代码和EM_ *指令时,我应该得到一个别名为" XYZ"在电子邮件地址之前的Outlook(我使用的是Outlook 2010)中,也只是收件箱视图中的别名。 outlook中收到的电子邮件没有别名。
Filename MAILBOX email CT="text/html" ;
Data _null_ ;
length HTML_DirLine $ 2048 ;
fid = fopen('MAILBOX','O');
/* write the TO email address */
HTML_DirLine = '!EM_TO! ( "abc@abc.com" )' ;
fputrc1 = fput(fid,trim(HTML_DirLine));
rc = fwrite(fid);
/* write the FROM email address */
HTML_DirLine = '!EM_FROM! ( " XYZ <abc@abc.com>" )' ;
fputrc1 = fput(fid,trim(HTML_DirLine));
rc = fwrite(fid);
/* write the SENDER email address */
HTML_DirLine = '!EM_SENDER! ( " XYZ <abc@abc.com>" )' ;
fputrc1 = fput(fid,trim(HTML_DirLine));
rc = fwrite(fid);
/* write the Subject email address */
HTML_DirLine = '!EM_SUBJECT! Test Email ' ;
fputrc1 = fput(fid,trim(HTML_DirLine));
rc = fwrite(fid);
/* write the Body of email message */
HTML_DirLine = 'This is the test email. Pls ignore.' ;
fputrc1 = fput(fid,trim(HTML_DirLine));
rc = fwrite(fid);
/* Send the email message */
HTML_DirLine = '!EM_SEND!' ;
fputrc1 = fput(fid,trim(HTML_DirLine));
rc = fclose(fid);
run ;
但是当我使用没有指令时它工作正常。以下是代码,
Filename mailbox EMAIL ;
Data _null_ ;
File mailbox TO='abc@abc.com'
Subject='Test Email message'
from='XYZ <abc@abc.com>'
sender='XYZ <abc@abc.com>' ;
put "Hi There,"
put "Please ignore this test email" ;
run ;
有关如何使用SAS中的指令正确显示别名的任何建议吗?感谢
答案 0 :(得分:1)
这些是我从两个测试电子邮件中获得的标题(在Mozilla Thunderbird中查看):
使用指令:
Delivered-To: abc@gmail.com
Received: by 10.200.49.247 with SMTP id i52csp1678880qte;
Tue, 26 Jul 2016 00:47:07 -0700 (PDT)
X-Received: by 10.194.5.230 with SMTP id v6mr21227765wjv.92.1469519227576;
Tue, 26 Jul 2016 00:47:07 -0700 (PDT)
Return-Path: <abc@gmail.com>
Received: from localhost.localdomain (host217-39-41-194.range217-39.btcentralplus.com. [217.39.41.194])
by mx.google.com with ESMTP id dq8si18546922wjb.285.2016.07.26.00.47.06
for <abc@gmail.com>;
Tue, 26 Jul 2016 00:47:07 -0700 (PDT)
Received-SPF: softfail (google.com: domain of transitioning abc@gmail.com does not designate 217.39.41.194 as permitted sender) client-ip=217.39.41.194;
Authentication-Results: mx.google.com;
spf=softfail (google.com: domain of transitioning abc@gmail.com does not designate 217.39.41.194 as permitted sender) smtp.mailfrom=abc@gmail.com
Received: from localhost (localhost [IPv6:::1])
by localhost.localdomain (Postfix) with SMTP id 38ACD226E8
for <abc@gmail.com>; Tue, 26 Jul 2016 07:47:11 +0000 (UTC)
Date: 26 Jul 2016 07:47:11 -0000
Subject: =?utf-8?B?VGVzdCBFbWFpbA==?=
From: " XYZ <abc@gmail.com>"@localhost.localdomain
Sender: ( " XYZ <abc@gmail.com>" )
To: abc@gmail.com
X-Mailer: 9.04.01M3P062415
MIME-Version: 1.0
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: base64
Message-Id: <20160726074711.38ACD226E8@localhost.localdomain>
VGhpcyBpcyB0aGUgdGVzdCBlbWFpbC4gUGxzIGlnbm9yZS4=
没有指令:
Delivered-To: abc@gmail.com
Received: by 10.200.49.247 with SMTP id i52csp1677118qte;
Tue, 26 Jul 2016 00:42:39 -0700 (PDT)
X-Received: by 10.28.238.154 with SMTP id j26mr47226158wmi.94.1469518959773;
Tue, 26 Jul 2016 00:42:39 -0700 (PDT)
Return-Path: <abc@gmail.com>
Received: from localhost.localdomain (host217-39-41-194.range217-39.btcentralplus.com. [217.39.41.194])
by mx.google.com with ESMTP id v2si18549245wjh.115.2016.07.26.00.42.39
for <abc@gmail.com>;
Tue, 26 Jul 2016 00:42:39 -0700 (PDT)
Received-SPF: softfail (google.com: domain of transitioning abc@gmail.com does not designate 217.39.41.194 as permitted sender) client-ip=217.39.41.194;
Authentication-Results: mx.google.com;
spf=softfail (google.com: domain of transitioning abc@gmail.com does not designate 217.39.41.194 as permitted sender) smtp.mailfrom=abc@gmail.com;
dmarc=fail (p=NONE dis=NONE) header.from=gmail.com
Received: from localhost (localhost [IPv6:::1])
by localhost.localdomain (Postfix) with SMTP id 78EA7226F2
for <abc@gmail.com>; Tue, 26 Jul 2016 07:42:44 +0000 (UTC)
Date: 26 Jul 2016 07:42:44 -0000
Subject: =?utf-8?B?VGVzdCBFbWFpbCBtZXNzYWdl?=
From: XYZ <abc@gmail.com>
Sender: XYZ <abc@gmail.com>
To: abc@gmail.com
X-Mailer: 9.04.01M3P062415
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: base64
Message-Id: <20160726074244.78EA7226F2@localhost.localdomain>
SGkgVGhlcmUsClBsZWFzZSBpZ25vcmUgdGhpcyB0ZXN0IGVtYWls
这两个都有一个发送方头,但是当使用这些指令时,你似乎已经选择了一组额外的括号。我将适当的行更改为:
HTML_DirLine = '!EM_SENDER! "XYZ <abc@abc.com>"' ;
并且似乎修复它以便生成相同的输出。如果发送电子邮件的服务器未列在原始域的MX记录中,即使正确填充了发件人标头,您仍可能发现您的电子邮件客户端不显示发件人。
顺便说一句,为什么在代码中使用fopen
/ fput
等所有指令? put
语句在这里更简单,也可以正常工作。