Send email failed
How can i send email to multiple clients located in different domains such hotmail,yahoo,and gmail
is it required to provide Smpt server name, if we have multipe domain id, what should we do?
I am using fowling code but getting exception failed.
MailMessage mailMsg = new MailMessage();
mailMsg .From = "[email protected]";
mailMsg .To = "[email protected]";
mailMsg .Cc = "[email protected]"";
mailMsg .Bcc = "[email protected]";
mailMsg .Subject = "SubjectOfTheMailString";
mailMsg .Body = "BodyOfTheMailString";
SmtpMail.Send(mailMsg );
Thanks,

Tanmay SarkarRank #1,407 · 1.2K reputationPosted Sep 21, 2010, 6:30 AM EDT
smtp.gmail.com
& port no 587
i think you don't need any other code, as you implement it.
If it help you then mark it as an accepted answer.
Thank you!
Koteswararao MallisettiRank #2,740 · 511 reputationPosted Sep 21, 2010, 6:31 AM EDT
mailmsg.To.add( new MailAddress("addres here ")); like this you can add any number of address like multiple To addresses you can add multiple cc as well as bcc also
Posted Sep 21, 2010, 7:28 AM EDT
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Mail;
namespace consolemail
{
class Program
{
static void Main(string[] args)
{
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
System.Net.NetworkCredential AuthInfo = new
System.Net.NetworkCredential("[email protected]", "babilona");
message.To.Add("[email protected]");
message.To.Add("[email protected]");
message.To.Add("[email protected]");
message.Subject = "Test Mail using System.Net.Mail";
message.From = new MailAddress("[email protected]");
string str = "Hai to all";
message.Body = str;
bool isBodyHtml = true;
message.IsBodyHtml = isBodyHtml;
message.Attachments.Add(new Attachment("c:\\something.txt"));
message.SubjectEncoding = System.Text.Encoding.UTF8;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.Priority = MailPriority.High;
smtp.Host = "smtp.gmail.com";
smtp.UseDefaultCredentials = false;
smtp.Credentials = AuthInfo;
smtp.Timeout = 20000;
smtp.Port = 587;
// use stmp.port = 587 if 465 does not work.
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
try
{
smtp.Send(message);
Console.WriteLine("E-mail has been sent succesfully");
Console.ReadLine();
}
catch (System.Net.Mail.SmtpException ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}
Hai use this peice of code..
Use .Net Framework 2.0 and Higher..
Hope i made myself clear...
With Regards
P.Krishna Prasad
----------------------------------------------------------------------------------------------------------
If someway my answer helped u..Don't forget to mark it as correct answer..