对于应用程序,我们希望向用户提供生成的 EML,他们可以在 Outlook 2010 中打开这些 EML,并在对邮件内容进行最小更改或添加附件或收件人后发送。我们在生成 EML 时设置的其中一件事是“发件人”地址,我们将其设置为邮箱。所有用户都可以访问此邮箱,但是当他们打开 EML 并尝试发送它时,总是会返回错误:
Delivery has failed to these recipients or groups:
recipient1@foo.com
You can't send a message on behalf of this user unless you have permission to do so. Please make sure you're sending on behalf of the correct sender, or request the necessary permission. If the problem continues, please contact your helpdesk.
但是,如果用户打开邮件,通过在“发件人”组合框中选择邮箱来手动设置邮箱(请注意,电子邮件中没有任何视觉上的变化),然后发送邮件,则邮件已成功传递。在我看来,为了成功指定“发件人”地址,我在 EML 中遗漏了一些东西。我想相信只要打开邮件的用户有权访问邮箱,邮件就应该能够成功发送。
EML 的示例如下:
From: Test-Mailbox@foo.com
To: recipient1@foo.com, recipient2@foo.com
Cc: ccRecipient@foo.com
Bcc: bccRecipient@foo.com
Message-ID: <29094346.1.1409121155408.JavaMail.tester@wd34376>
Subject: subject
MIME-Version: 1.0
Content-Type: multipart/related;
boundary="----=_Part_0_30562042.1409121155299"
X-Unsent: 1
------=_Part_0_30562042.1409121155299
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
body goes here
------=_Part_0_30562042.1409121155299--