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.