Hi..

Can anyone help me out with reference site or Code to handle multiple email server in c#.I have a task of sending Mass Emails to users.

Do you already have emails of users?
If you have an account on gmail, you can simply use it, to send emails to others.
What you need, is to create a list of users (with their emails is enough), and then do a loop through them and on each loop execute this code:

List<string> emails = new List<string>();
//fill the list with emails!

foreach(string email in emails)
{
    System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
    System.Net.NetworkCredential cred = new System.Net.NetworkCredential(”yourid@gmail.com”, “your password”); //of your email accout
    mail.To.Add(”acme@acme.com”); //email of user //do through a loop
    mail.Subject = “subject”;
    mail.From = new System.Net.Mail.MailAddress(”yourid@gmail.com”);
    mail.IsBodyHtml = true;
    mail.Body = “message to send”;

    System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(”smtp.gmail.com”);
    smtp.UseDefaultCredentials = false;
    smtp.EnableSsl = true;
    smtp.Credentials = cred;
    smtp.Port = 587; //this is of gmail
    smtp.Send(mail);
}

Hi

Thanks for your reply..but am looking for sending emails to multiple email servers..for eg one user may have gmail account whereas the other with yahoo....So how can i send newsletters to all mail id in one click ...

With my code. Its not important what email users have, as long as yours in gmail (it can be other too, but I showed you an example how this can be done with using gmail).
So:

List<string> emails = new List<string>();
email.Add("abc@gmail.com");
email.Add("bcd@hotmail.com");
email.Add("cde@yahoo.com");

//and so on..
This article has been dead for over six months. Start a new discussion instead.