Click here to Skip to main content
15,906,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to send email in asp.net when the user enters the from address email in the textbox and to address will be constant in our form using c#. So please send this query if any one knows its very urgent please help me out.


Thanks & regards

Srikanth.J
Posted

Something like this:
MailMessage mail = new MailMessage();
mail.To.Add("to_address1@something.com");
mail.To.Add("to_address2@something.com");
mail.From = new MailAddress("noreply@something.com");
mail.Subject = "Subject here";
mail.Body = "Body text here";

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.something.com";
smtp.Credentials = new System.Net.NetworkCredential("UserName","Password");
smtp.Send(mail);
 
Share this answer
 
Hi Srikanth,

Please use System.NET.Mail namespace

refer this link
 
Share this answer
 

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