3

Effectively I'm trying to send some template emails so that I can test a few components that handle reading from mailboxes.

I could just load up outlook and send a couple of emails but I'm looking to find a solution that can read thousands of emails at a time so I need to bulk send these templates t test the reading code.

When I say bulk send ... I have about 10 to 15 templates (varies) and I want to send about 1,000 copies of each to the given mailbox.

Now here's th sticking point ...

I could just fire up an instance of the SMTP client and declare a new MailMessage object then send that using the SMTP client ... the problem is that my email templates contain custom header info so its not just a matter of msg.Body = someText and then setting the To and From and Subject fields.

I don't want to spend time manually parsing these emails because the headers are quite lengthy and contain a lot of custom values that I'll be working on later.

So if I have a txt or eml file how do I send that raw text to my mailbox so I can perform my afformentioned testing?

Himanshu Jansari
  • 30,115
  • 28
  • 106
  • 129
War
  • 8,399
  • 3
  • 45
  • 96

3 Answers3

2

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)

Joshua
  • 3,375
  • 3
  • 26
  • 19
  • Yeh there's quite a few of these "mail components" i was hoping to roll my own to save the $500 bill, i have now solved the problem using something called SMTP Express from a company called QuickSoft. It's a product we already have internally so there was no cost, all i do is dump my raw string to a file named anything.eml in a given pickup directory and it does the grunt work. – War Jan 27 '12 at 10:40
0

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.

tripleee
  • 158,107
  • 27
  • 234
  • 292
0

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.

jpierson
  • 15,160
  • 11
  • 100
  • 144