Click here to Skip to main content
15,897,371 members
Articles / Web Development / ASP.NET

sending email using localhost

Rate me:
Please Sign up or sign in to vote.
1.00/5 (1 vote)
24 Dec 2012CPOL 0  
Assuming your users can type, all you have to do is execute the line:toAddress = new MailAddress(myTextbox.Text);before you create the new MailMessage.[edit]Typo - forgot to change fixed string to use textbox content.[/edit]

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
24 Dec 2012symonsarwar 3 alternatives  
Hi,In my website I am sending email from localhost.If I specify the email address to whom(e.g.;someone@gmail.com) I want to send email it succeeds, but I would like to retreive the (var toAddress) value from the text box control.If i do this it gives the error:"The specified string is...
Please Sign up or sign in to vote.
24 Dec 2012Krunal Rohit
var smtp = new System.Net.Mail.SmtpClient(); { smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(fromAddress,...
Please Sign up or sign in to vote.
24 Dec 2012Riasat Azim Dip
public void Messegesend(string email,string firstname,string lastname,string messege) { try { string messegebody = "Dear Admin " + "\n" + messege + "\n Thanks \n " + firstname + " " + lastname + " \n" + email; ...

License

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


Written By
CEO
Wales Wales
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?

Comments and Discussions