[英]Forward emails via C# SMTP client and keep time stamps and delivery time
I wrote a C# client to download emails from my POP3 mailbox and forward them to my internal exchange server via SMTP. 我写了一个C#客户端来从我的POP3邮箱下载电子邮件,然后通过SMTP将它们转发到我的内部交换服务器。
The code below is working. 以下代码正在运行。 But the time stamps and delivery time information from the original email are overwritten hence lost because this code will create a complete new email.
但原始电子邮件中的时间戳和交付时间信息会被覆盖,因此丢失,因为此代码将创建一个完整的新电子邮件。
Is there any chance to forward emails without loosing the time stamp information from the original email? 是否有机会转发电子邮件而不丢失原始电子邮件中的时间戳信息?
using (SmtpClient smtp = new SmtpClient())
{
smtp.Connect(connectionServer["ExchangeServer"], 25);
try
{
smtp.Ehlo(connectionServer["ExchangeServer"] + "." +
connectionServer["ExchangeServerDomain"] + ".local");
}
catch
{
success = false;
smtp.Helo(connectionServer["ExchangeServer"] + "." +
connectionServer["ExchangeServerDomain"] + ".local");
}
smtp.MailFrom("");
smtp.RcptTo(popReceipient);
smtp.DataFromFile(path);
smtp.Disconnect();
}
It's not possible. 这是不可能的。 Another option would be to use OpenPop.Net to send a separate email with the original email attached as a "*.eml" file that can be open with most email clients.
另一种选择是使用OpenPop.Net发送单独的电子邮件,其中附有原始电子邮件作为“* .eml”文件,可以与大多数电子邮件客户端一起打开。 I can post some code if this approach is useful for you.
如果这种方法对你有用,我可以发布一些代码。
Can you access your destination server via IMAP? 您可以通过IMAP访问目标服务器吗?
If so, you can append the mail to your INBOX folder with arbitrary time stamps. 如果是这样,您可以使用任意时间戳将邮件附加到INBOX文件夹。 If you can access your source server via IMAP, you can actually get the INTERNALDATE as well to use as the timestamp.
如果您可以通过IMAP访问源服务器,您实际上也可以使用INTERNALDATE作为时间戳。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.