Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my asp page i want to sent mail to different mail(for ex: abc@gmail.com; abc@yahoo.com; abc@live.com and so on..)
C#
MailMessage mail = new MailMessage();
mail.To.Add(txtTo.Text);
//mail.To.Add("Another Email ID where you wanna send same email");
mail.From = new MailAddress("test.sathish4303@gmail.com");
mail.Subject = txtSubject.Text;
mail.Body = txtBody.Text;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
check_mailid();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Credentials = new System.Net.NetworkCredential("test.mail03@gmail.com", "xxxyyy");
smtp.EnableSsl = true;
smtp.Send(mail);

but this is used for only g mail.

please some one help me....
Posted
v2
Comments
AnkitGoel.com 11-Dec-12 2:33am    
this code will work to send mails to any domain. depends on how you use it.
OriginalGriff 11-Dec-12 2:36am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
At the moment, there doesn't seem to be a question here!
Use the "Improve question" widget to edit your question and provide better information.
What you exactly want to do ?
You want to send mail to different mail ids from one gmail account, right ?

1 solution

Hi,

This will work for all ids. You may be confused by seeing
C#
smtp.Host = "smtp.gmail.com";
line.
It is just smtp server name. Don't worry about it...
Though you get error, then please send you code and where error comes....
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900