通过LotusScript创建Mime邮件消息时,我发现进入mimeHeader字段的每个收件人在收件人(外部)邮件客户端显示三次(如果我通过我的Notes客户端打开该邮件,则不会发生)。
以下是我的测试代码的相关片段:
sn.Convertmime = False
Set db = sn.Currentdatabase
Set doc = db.Createdocument()
Set nstr = sn.Createstream()
Set mimeRoot = doc.Createmimeentity("body")
Set mimeHeader = mimeRoot.Createheader("To")
Call mimeHeader.setHeaderVal("some.recipient@mail.com")
Set mimeHeader = mimeRoot.Createheader("CC")
Call mimeHeader.setHeaderVal("other.recipient@mail.com")
Set mimeHeader = mimeRoot.Createheader("Subject")
Call mimeHeader.Addvaltext("Testmail MIME multipart (Part 1: set recipients in mimeHeader)", "utf-8")
sMimeBoundary = LCase(doc.UniversalID)
Set mimeRootChild = mimeRoot.createChildEntity
Set mimeHeader = mimeRootChild.createHeader("Content-Type")
Call mimeHeader.setHeaderVal("multipart/mixed; boundary='" + sMimeBoundary + "'")
Set mimeEntity = mimeRootChild.createChildEntity
Call nstr.Writetext("<div>Mail body, first line</div><br/>" &_
{<div>###Second line with different <span style=color:red;>formatting</span>###</div>")
Call mimeEntity.setContentFromText(nstr, "text/html;charset='utf-8'", ENC_NONE)
Call nstr.close
Call nstr.Truncate()
Call doc.Send(False)
sn.Convertmime = True
生成的邮件(例如在Outlook或Thunderbird等中)显示“TO”和“CC”字段的三个独立实例,每个字段持有单个收件人的地址。摘自收到的邮件的源代码(摘自Thunderbird):
MIME-Version: 1.0
Auto-Submitted: auto-generated
To: some.recipient@mail.com
CC: other.recipient@mail.com
To: some.recipient@mail.com
CC: other.recipient@mail.com
To: some.recipient@mail.com
CC: other.recipient@mail.com
Message-ID: <OF58C4AF46.9EDA9225-ONC125822D.0043D902-C125822D.0043E7C3@xxx.de>
From: Lothar Mueller <some.recipient@mail.com>
Date: Wed, 7 Feb 2018 13:21:04 +0100
X-MIMETrack: Itemize by NLNOTES.EXE on Lothar Mueller/xxx/DE(Release 9.0.1FP9|August
15, 2017) at 07.02.2018 13:21:42,
Serialize by Router on DomServer/xxx/DE at 07.02.2018 13:21:05,
Serialize complete at 07.02.2018 13:21:05
MIME-Version: 1.0
MIME-Version: 1.0
将相同的邮件发送到我的Notes帐户并在那里进行检查我发现它包含以下字段:
* SendTo / * CopyTo字段的每个实例都包含相同的 MIME标头内容,例如
Effective Notes Value: "other.recipient@mail.com"
Original RFC822 Item Name: "CC"
Original RFC822 Item Delimiter: ": "
Original RFC822 Item Body: "other.recipient@mail.com
"
因此,实际上Notes邮件包含三条相同的指令来创建TO和CC字段。
问题是:如何阻止Notes / Domino执行此操作?我首选的方法是通过某种编码,而不是服务器配置中的某些设置
编辑:刚刚尝试了将“收件人”直接写入Notes字段的“旧学校”方法,如Call doc.replaceItemValue("SendTo", "some.recipient@mail.com")
中所述。
结果:不再增加收件人,即只有一个TO和CC字段的实例。这真的是首选方式吗?