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

sending email using localhost

Rate me:
Please Sign up or sign in to vote.
1.00/5 (2 votes)
24 Dec 2012CPOL 4.4K  
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...

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 2012OriginalGriff
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]
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
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions