对于我们希望为用户提供的应用程序,他们可以在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--
我找到了一种方法,可以正确地将邮箱设置为发件人,但它涉及到在Outlook的VB中通过在MailItem的Open事件中设置SentOnBehalfOfName来指定宏。不完全是我喜欢的解决方案。。。