I need to send email via my C# app.
I come from a VB 6 background and had a lot of bad experiences with the MAPI control. First of all, MAPI did not support HTML emails and second, all the emails were sent to my default mail outbox. So I still needed to click on send receive.
If I needed to send bulk html bodied emails (100 - 200), what would be the best way to do this in C#?
Thanks in advance.
The best way to send bulk emails for more faster way is to use threads.I have written this console application for sending bulk emails.I have seperated the bulk email ID into two batches by creating two thread pools.
I have defined 10 recepients in the array list for a sample.It will create two batches of emails to create two thread pools to send mails.You can pick the details from your database also.
You can use this code by copying and pasting it in a console application.(Replacing the program.cs file).Then the application is ready to use.
I hope this helps you :).
Let's make something as a full solution :). Maybe it can help as well. It is a solution for sending one email content and one attach file (or without attach) to many Email addresses. Of course sending just one email is possibility as well. Result is List object with data what is OK and what is not.
I can strongly recommend the aspNetEmail library: http://www.aspnetemail.com/
The
System.Net.Mail
will get you somewhere if your needs are only basic, but if you run into trouble, please check out aspNetEmail. It has saved me a bunch of time, and I know of other develoeprs who also swear by it!You could use the System.Net.Mail.MailMessage class of the .NET framework.
You can find the MSDN documentation here.
Here is a simple example (code snippet):
You can send email using SMTP or CDO
using SMTP:
source : C# SMTP Email
Source: C# CDO Email
Manly
Use the namespace System.Net.Mail. Here is a link to the MSDN page
You can send emails using SmtpClient class.
I paraphrased the code sample, so checkout MSDNfor details.
The best way to send many emails would be to put something like this in forloop and send away!