+1 vote

Hi

I have several thousand EML files to send to a vendor via SMTP. I need to send these EML files without updating the actual "To" field. I am being advised I can do this by using "RCPT TO".

I kindly request assistance as to how to do this, please.

This is fairly urgent as I have a deadline of Monday.

Be safe, be healthy, be happy :)

Best regards,

DK

by (250 points)

1 Answer

0 votes

This should help:

using (Smtp smtp = new Smtp())
{
    smtp.Connect("server.company.com");
    smtp.UseBestLogin("user", "password");

    SmtpMail smtpMail = SmtpMail.CreateFromEmlFile(@"c:\email.eml");

    smtp.SendMessage(smtpMail);
    smtp.Close();
}

https://www.limilabs.com/blog/send-raw-data-eml-file

Once you have the SmtpMail envelope you can set its To property (it is used for RCPT TO command) independently of the email's To header.

smtpMail.To.Clear();
smtpMail.To.Add("rcpto@example.com");

Consider turning on logging as well:
https://www.limilabs.com/blog/logging-in-mail-dll
You'll see exactly the commands that Mail.dll email client sends.

by (297k points)
edited by
...