1

I wrote a C# client to download emails from my POP3 mailbox and forward them to my internal exchange server via 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();
}
Quality Catalyst
  • 6,531
  • 8
  • 38
  • 62
Simon
  • 377
  • 2
  • 11
  • 30
  • unfortunately its not possible – Steve Jan 04 '17 at 20:44
  • Thanks for your reply Steve. I nearly already thought that this will be maybe the answer... But there was a little hope that there is a trick. I think that is maybe for security reasons. – Simon Jan 05 '17 at 05:39

2 Answers2

0

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. I can post some code if this approach is useful for you.

Crabax
  • 36
  • 5
  • Could be a work around but the handling for the end user is a little bit tricky. In my case this is not possible and I maybe have to accept the little time difference from downloading and forwarding the pop3 email. – Simon Jan 05 '17 at 05:43
0

Can you access your destination server via IMAP?

If so, you can append the mail to your INBOX folder with arbitrary time stamps. If you can access your source server via IMAP, you can actually get the INTERNALDATE as well to use as the timestamp.

Max
  • 10,701
  • 2
  • 24
  • 48