How do i send an email when i already have it as a string?

蹲街弑〆低调 提交于 2019-12-05 21:17:09

The best way I know to do this is using MailBee.NET objects which are not free, but you can download a trial: http://www.afterlogic.com/mailbee-net/email-components

Then what you are looking for is something like this:

            MailBee.Mime.MailMessage message = new MailMessage();
            message.LoadMessage(filestream);
            MailBee.SmtpMail.Smtp.QuickSend(message);

Disclosure: I don't work for AfterLogic, but some of their tools have been a big help with Elastic Email (http://elasticemail.com)

If you have a well-formed RFC822 message, just transfer it as-is in the DATA phase of the SMTP transaction. On Unix, it's basically just

sendmail -oi -t <file

On some Linux distros, sendmail is not installed on the PATH; try /usr/lib/sendmail or consult a forum for your particular distro if you cannot come up with a few informed guesses on your own.

Another one that came up in my search is EASendMail by Email Architect. Like MailBee.NET it's not free but I have found specific documentation that shows of the feature you are asking for by calling the SendRawMail method. That example is in C++/CLI but the same would apply to code written in C# or VB.NET. If I end up using trial to test it out I'll post my feedback here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!