Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9076457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:06:40+00:00 2026-06-16T19:06:40+00:00

using vb.net to send mail to outlook. but am getting error like the specified

  • 0

using vb.net to send mail to outlook. but am getting error like “the specified string is not in the form required for an e-mail address” How to solve this problem
Dim Var_from As String = TextBox1.Text
Dim to_var As String = TextBox2.Text

    Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()


    mailMessage.From = New System.Net.Mail.MailAddress("'" + Var_from + "'")
    mailMessage.To.Add("'" + to_var + "'")
    mailMessage.Subject = "xxx"

    Dim content As String = "<html xmlns='http://www.w3.org/1999/xhtml'><head><style type='text/css'>#mytable { padding: 0;   margin: 0;border-right: 1px solid #C1DAD7;border-bottom: 1px solid #C1DAD7;       border-left: 1px solid #C1DAD7;   border-top: 1px solid #C1DAD7;}caption {padding: 0 0 5px 0; width: 700px;font: Bold 11px 'Trebuchet MS', Verdana, Arial, Helvetica, sans-serif;      text-align: right;}th {   font: bold 11px 'Trebuchet MS', Verdana, Arial, Helvetica, sans-serif;     color: #4f6b72;      border-right: 1px solid #C1DAD7;border-bottom: 1px solid #C1DAD7;border-left: 1px solid #C1DAD7;border-top: 1px solid #C1DAD7;   letter-spacing: 2px; text-transform: uppercase; text-align: left;       padding: 6px 6px 6px 12px; background: #CAE8EA; }td {  border-right: 0px solid #C1DAD7;  border-bottom: 0px solid #C1DAD7; border-left: 0px solid #C1DAD7;   background: #fff;    padding: 6px 6px 6px 12px;  color: #4f6b72;}</style></head><body><table border='0' cellpadding='0' id='mytable'  width='100%'><tr><th height='74' style='text-align:center; font-size:16px;' colspan='6'>CAS E-mail Confirmation <div style='float:right;'><img src='cid:HDIImage1' width='143' height='62' align='left' alt='' style='position:absolute;top:0pc;'/></div></th></tr><tr><td colspan='6' class='style5'>&nbsp;Dear Customer,<br/><br/> Thank you for  registering CAS. Click the below link to complete your verification process.. <br/><br/><br/>CAS CODE  :  <br/><br/><br/><br/></td></tr>  <tr>    <th colspan='6' class='style5'>&nbsp;</th>  </tr></table></body></html>"

    Dim plainTextView As System.Net.Mail.AlternateView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(content, Nothing, "text/plain")

    mailMessage.AlternateViews.Add(plainTextView)
    Dim smtpClient As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()

    smtpClient.Host = "xxx"
    smtpClient.Send(mailMessage)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:06:41+00:00Added an answer on June 16, 2026 at 7:06 pm

    You need to use normal email addresses – the single quotes that you are adding might be causing the error. Do it without the extra quotes.

    mailMessage.From = New System.Net.Mail.MailAddress(Var_from)
    mailMessage.To.Add(to_var)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to send e-mail on ASP .Net using outlook address?? I've tried this code
I am using System.Net.Mail to to send mail. I do not know the type/version
Im trying to send a mail from a asp.net script, but im getting this
am using system.net.mail to send email as shown below, but its too slow. it
I've been getting the following exception when trying to send an e-mail using System.Net.Mail:
How can I send an email using SYstem.Net.Mail to an email address that is
I need to send mail daily using smtp and asp.net.
I am trying to send mail using SmtpClient() within my Winforms VB.Net program Here
I am trying to send an email in ASP.NET using system.net.mail the problem is
I am wondering what the best way to send bulk emails is using System.Net.Mail

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.