简体   繁体   English

通过C#SMTP客户端转发电子邮件并保留时间戳和交付时间

[英]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.

相关问题 通过C#SMTP发送的电子邮件无法通过电子邮件客户端发送 - Emails sent via C# SMTP are not seen through email client as sent 填写开放时间组合框并停止直到C#中的交付时间 - Fill in the Combobox of openingstime and stop untill delivery Time in C# 时间转换为客户端时间c# - Time conversion to client time c# C#中类似于Keylogger的应用程序,用于记录应用程序开始和结束的时间戳 - Keylogger-like application in C# to record time-stamps for application start and end 给定文本+谷歌语音到文本音频,获取时间戳的单词列表? 统一C# - Given text + Google speech-to-text audio, get list of words at time stamps? Unity C# 创建SMTP服务器并阅读电子邮件C# - creating smtp server and read the emails c# 通过 C# SMTP 发送给客户的电子邮件会直接成为某些邮件提供商的垃圾邮件 - Emails sent to customers via C# SMTP go straight to spam for some mail providers 通过 SendGrid C# SMTP 库发送电子邮件未发送到某些域 - Sending Emails via SendGrid C# SMTP Library aren't getting delivered to Certain domains C# - SMTP Gmail在发送时挂起。 第一次工作 - C# - SMTP Gmail hangs on send. Worked the first time C#.Net Socket Keep Alive 时间? - C# .Net Socket Keep Alive time?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM