1

I want to know more about the resent headers (resent-from, resent-to, resent-date etc) that get prepended to an email's header. When do these headers get added? Do they get added by the server or the mail client program?

I need to write a Java program using JavaMail api to forward an email (without changing or parsing through it's original content). I would like the email to be redirected to the destination email address on arriving at the server for a specific recepient. Any snippet where you have been able to forward / redirect a mime mail using the resent headers will be helpful.

Thank you

4

1 回答 1

0

请参阅RFC 2822的第 3.6.6 节。

您应该能够使用 JavaMail 将这些标头添加到消息中。如果邮件是从邮件服务器上的文件夹中读取的,您需要先复制邮件,然后才能对其进行更改。使用MimeMessage 复制构造函数。然后,您可以使用带有地址数组的Transport.send 方法将其发送到您想要的任何地址,忽略消息中的地址。如果您需要保留原始 Message-ID(这可能不合适,因为您正在修改消息),您需要继承 MimeMessage 并覆盖 updateHeaders 方法。

于 2014-05-30T03:58:04.797 回答