The specified string is not in the form required for an e-mail address

Find this post interesting? Do you like interesting things? Maybe you would like my invention, a connectible candle called a WickBrick!

Get one here


Need to create a MailAddress….. grrr

And if you want to convert from text inside of a textbox control to a MailAddress you need to use the .text property  i.e.

Dim fromUser As New MailAddress(from_txt.Text)



  1. The specified string is not in the form required for an e-mail address.
    public static void SendMail(string from, string to, string subject, string body)
    // Configure mail client (may need additional
    // code for authenticated SMTP servers)
    SmtpClient mailClient = new SmtpClient(BalloonShopConfiguration.MailServer);
    // Create the mail message
    MailMessage mailMessage = new MailMessage(from, to, subject, body);
    // Send mail
    public static void SendErrorLogEmail(Exception ex)
    string from = “BalloonShop Error Report”;
    string to = BalloonShopConfiguration.ErrorLogEmail;
    string subject = “BalloonShop Error Generated at ” + DateTime.Now.ToShortDateString();
    string body = ex.Message + “\n\n” + “Stack trace:\n” + ex.StackTrace.ToString();
    SendMail(from, to, subject, body);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s