Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to write a small tool to poll a POP3 account for new mails, then change a few addressing headers, then re-send via SMTP. I have some doubts and unknowns regarding how to best prepare the outgoing SMTP message.

I have two third-party, candidate POP3 clients, given .NET's glaring lack of functionality here, being OpenPop.NET[^], and MailKit[^]. OpenPop seems somewhat out of date, but how modern do you need to be with bloody POP3 anyway, and it at least has a Message object I get from POP3, called Message, which has a ToMailMessage method that returns a BCL message ready for the BCL SmtpClient. However, when I pull a mail that includes images (in HTML, not attachments), and send it on, the end mail has lost images.

To clarify, when I, as the end recipient, receive the mail just sent by my code, in my gmail client, I seem to get the 'text/plain' part of the mail rather than the 'text/html', where before sending, the MailMessage object has HTML as the default body, and plain text as an AlternateView.

Then, MailKit has both POP3 and SMTP clients, with a MimeMessage class common to both clients. Here, when I receive a message on the MailKit POP3 client, and directly send it via the MailKit SMTP client, all seems to go well, but the end recipient never receives the message.

I am using two different Gmail accounts, all I have access to, for dev and test purposes, but once you get past Google's fussiness with TLS, and successfully authenticate, the carrier shouldn't really be relevant.
Posted
Updated 3-May-15 20:15pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900