W
Wayne Wengert
Using the code below, I am trying to send an email from an ASP.NET 2.0 page
but I get the error " The specified string is not in the form required for
an e-mail address." when the "Dim Mailmsg..." line is executed. Since I
haven't defined the from/to yet, I don't understand what it wants? Any
insight on what causes this?
=========================================
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress("To Name
<[email protected]>")
Mailmsg.From = New System.Net.Mail.MailAddress("From Name
<[email protected]>")
Mailmsg.Subject = "(subject text)"
Try
Mailmsg.Body = "(message text here)"
obj.Send(Mailmsg)
Catch ex As Exception
Response.Write("Error: " & ex.ToString())
End Try
=========================================
but I get the error " The specified string is not in the form required for
an e-mail address." when the "Dim Mailmsg..." line is executed. Since I
haven't defined the from/to yet, I don't understand what it wants? Any
insight on what causes this?
=========================================
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress("To Name
<[email protected]>")
Mailmsg.From = New System.Net.Mail.MailAddress("From Name
<[email protected]>")
Mailmsg.Subject = "(subject text)"
Try
Mailmsg.Body = "(message text here)"
obj.Send(Mailmsg)
Catch ex As Exception
Response.Write("Error: " & ex.ToString())
End Try
=========================================