Serenity
Serenity

Reputation: 5098

regarding sending mail to user

MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");

Now for fetching email entered by the user in the textbox, I wrote:-

 message.To.Add(Convert.ToString(txtEmail));

but this is not working..isn't this the correct way to add email address in "To" ? txtEmail is the textbox's name..Its not giving any error or something..just not working..when I comment out this line of code..the code line next to it works..otherwise code stops working when it encounters this "To.Add " method..plz help..thnx

[edit] I changed it to

message.To.Add(txtEmail.ToString());

still not working

Upvotes: 0

Views: 46

Answers (1)

Umair A.
Umair A.

Reputation: 6873

txtEmail.Text

should work.

Try to make it

message.To.Add(txtEmail.Text);

Upvotes: 3

Related Questions