Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2009-05-13
Medium Priority
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("");
                mail.To.Add = textEmailAdd.Text;
                mail.Subject = "Test E-Mail";
                mail.Body = html;
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient("");

Open in new window

Question by:devnewbee
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
LVL 10

Accepted Solution

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

Expert Comment

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

Expert Comment

by:Jamie McAllister MVP
ID: 24375236
mail.To.Add = new MailAddress(textEmailAdd.Text);
Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.


Author Closing Comment

ID: 31580992
Thanks so much.  I appreciate your help.

Author Comment

ID: 24375247
Thanks to everyone.
LVL 10

Expert Comment

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 ...

LVL 16

Expert Comment

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

Featured Post

Vim Reference Guide

Vim is a powerful text editor favored by many sysadmins and developers - here are some commands that you'll want to keep in your back pocket!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

721 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