Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I make the value of my "mailaddress to" the value of a textbox?

Posted on 2009-05-13
7
Medium Priority
?
263 Views
Last Modified: 2013-11-07
This will not work. ( mail.To.Add = textEmailAdd.Text;)

What am I doing wrong?
MailMessage mail = new MailMessage();
                mail.From = new MailAddress("do-not-reply@test.com");
                mail.To.Add = textEmailAdd.Text;
                mail.Subject = "Test E-Mail";
                mail.Body = html;
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient("test.smtp.com");
                smtp.Send(mail);

Open in new window

0
Comment
Question by:devnewbee
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 10

Accepted Solution

by:
MaxOvrdrv2 earned 2000 total points
ID: 24375194
mail.To.Add(new MailAddress(textEmailAdd.Text) );
0
 
LVL 16

Expert Comment

by:Walter Ritzel
ID: 24375227
mail.To = textEmailAdd.Text;
0
 
LVL 32

Expert Comment

by:Jamie McAllister MVP
ID: 24375236
mail.To.Add = new MailAddress(textEmailAdd.Text);
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Closing Comment

by:devnewbee
ID: 31580992
Thanks so much.  I appreciate your help.
0
 

Author Comment

by:devnewbee
ID: 24375247
Thanks to everyone.
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24375273
sorry wp and Jaime... but for future if anyone asks this, the Add option of the MailMessage object is a function... so you have to call it as such, and it takes a MailAddress var ...

cheers!
0
 
LVL 16

Expert Comment

by:Walter Ritzel
ID: 24375333
Well,
my mistake is think of on the deprecated System.We.Mail namespace.... I look into an old code of mine...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question