对于应用程序,我们希望为用户提供生成的EML,这些EML可以在Outlook 2010中打开,并在对邮件内容进行最小更改或添加附件或收件人后发送。我们在生成EML时设置的一件事是'From'地址,我们将其设置为邮箱。所有用户都可以访问此邮箱,但是当他们打开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--
答案 0 :(得分:0)
我想办法如何正确设置邮箱作为发件人,但它涉及通过在MailItem的Open事件中设置SentOnBehalfOfName在Outlook中指定VB中的宏。不完全是我首选的解决方案...