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
<toname@dotnet.itags.org.todomain.com>")
Mailmsg.From = New System.Net.Mail.MailAddress("From Name
<fromname@dotnet.itags.org.yourfromdomain.com>")
Mailmsg.Subject = "(subject text)"
Try
Mailmsg.Body = "(message text here)"
obj.Send(Mailmsg)
Catch ex As Exception
Response.Write("Error: " & ex.ToString())
End Try
=========================================re:
> Since I haven't defined the from/to yet
Actually, you *have* defined it, as :
Mailmsg.To.Add(New System.Net.Mail.MailAddress("To Name <toname@.todomain.com>")
Mailmsg.From = New System.Net.Mail.MailAddress("From Name <fromname@.yourfromdomain.com>")
It's expecting a mail address in the form :
new MailAddress("somebody@.somewhere.com", "Some Name");
Try :
Mailmsg.To.Add(New System.Net.Mail.MailAddress("toname@.todomain.com", "To Name")
Mailmsg.From = New System.Net.Mail.MailAddress("fromname@.yourfromdomain.com", "From Name")
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%233LbeOeRGHA.1204@.TK2MSFTNGP12.phx.gbl...
> 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 <toname@.todomain.com>")
> Mailmsg.From = New System.Net.Mail.MailAddress("From Name <fromname@.yourfromdomain.com>")
> Mailmsg.Subject = "(subject text)"
> Try
> Mailmsg.Body = "(message text here)"
> obj.Send(Mailmsg)
> Catch ex As Exception
> Response.Write("Error: " & ex.ToString())
> End Try
> =========================================
I hsould have added...
See http://msdn2.microsoft.com/en-us/li...ailaddress.aspx
and http://msdn2.microsoft.com/en-us/li...fkf(VS.80).aspx
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:uzKgxteRGHA.4960@.TK2MSFTNGP12.phx.gbl...
> re:
>> Since I haven't defined the from/to yet
> Actually, you *have* defined it, as :
> Mailmsg.To.Add(New System.Net.Mail.MailAddress("To Name <toname@.todomain.com>")
> Mailmsg.From = New System.Net.Mail.MailAddress("From Name <fromname@.yourfromdomain.com>")
> It's expecting a mail address in the form :
> new MailAddress("somebody@.somewhere.com", "Some Name");
> Try :
> Mailmsg.To.Add(New System.Net.Mail.MailAddress("toname@.todomain.com", "To Name")
> Mailmsg.From = New System.Net.Mail.MailAddress("fromname@.yourfromdomain.com", "From Name")
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaol : http://asp.net.do/foros/
> ===================================
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%233LbeOeRGHA.1204@.TK2MSFTNGP12.phx.gbl...
>> 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 <toname@.todomain.com>")
>> Mailmsg.From = New System.Net.Mail.MailAddress("From Name <fromname@.yourfromdomain.com>")
>> Mailmsg.Subject = "(subject text)"
>> Try
>> Mailmsg.Body = "(message text here)"
>> obj.Send(Mailmsg)
>> Catch ex As Exception
>> Response.Write("Error: " & ex.ToString())
>> End Try
>> =========================================
>>
I'm confused. The error occurs on the "Dim Mailmsg..." before the To and
From addresses are set?
Wayne
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:uzKgxteRGHA.4960@.TK2MSFTNGP12.phx.gbl...
> re:
>> Since I haven't defined the from/to yet
> Actually, you *have* defined it, as :
> Mailmsg.To.Add(New System.Net.Mail.MailAddress("To Name
> <toname@.todomain.com>")
> Mailmsg.From = New System.Net.Mail.MailAddress("From Name
> <fromname@.yourfromdomain.com>")
> It's expecting a mail address in the form :
> new MailAddress("somebody@.somewhere.com", "Some Name");
> Try :
> Mailmsg.To.Add(New System.Net.Mail.MailAddress("toname@.todomain.com", "To
> Name")
> Mailmsg.From = New
> System.Net.Mail.MailAddress("fromname@.yourfromdomain.com", "From Name")
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaol : http://asp.net.do/foros/
> ===================================
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%233LbeOeRGHA.1204@.TK2MSFTNGP12.phx.gbl...
>> 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
>> <toname@.todomain.com>")
>> Mailmsg.From = New System.Net.Mail.MailAddress("From Name
>> <fromname@.yourfromdomain.com>")
>> Mailmsg.Subject = "(subject text)"
>> Try
>> Mailmsg.Body = "(message text here)"
>> obj.Send(Mailmsg)
>> Catch ex As Exception
>> Response.Write("Error: " & ex.ToString())
>> End Try
>> =========================================
>>
Sure, that's standard OOP procedure.
When you call an object, all of its components are called, too.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:uagy1xfRGHA.1608@.TK2MSFTNGP09.phx.gbl...
> I'm confused. The error occurs on the "Dim Mailmsg..." before the To and From addresses are set?
> Wayne
> "Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
> news:uzKgxteRGHA.4960@.TK2MSFTNGP12.phx.gbl...
>> re:
>>> Since I haven't defined the from/to yet
>>
>> Actually, you *have* defined it, as :
>>
>> Mailmsg.To.Add(New System.Net.Mail.MailAddress("To Name <toname@.todomain.com>")
>> Mailmsg.From = New System.Net.Mail.MailAddress("From Name <fromname@.yourfromdomain.com>")
>>
>> It's expecting a mail address in the form :
>>
>> new MailAddress("somebody@.somewhere.com", "Some Name");
>>
>> Try :
>>
>> Mailmsg.To.Add(New System.Net.Mail.MailAddress("toname@.todomain.com", "To Name")
>> Mailmsg.From = New System.Net.Mail.MailAddress("fromname@.yourfromdomain.com", "From Name")
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
>> news:%233LbeOeRGHA.1204@.TK2MSFTNGP12.phx.gbl...
>>> 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 <toname@.todomain.com>")
>>> Mailmsg.From = New System.Net.Mail.MailAddress("From Name <fromname@.yourfromdomain.com>")
>>> Mailmsg.Subject = "(subject text)"
>>> Try
>>> Mailmsg.Body = "(message text here)"
>>> obj.Send(Mailmsg)
>>> Catch ex As Exception
>>> Response.Write("Error: " & ex.ToString())
>>> End Try
>>> =========================================
>>>
>>
>>
I have 2.0 example mail code at my blog.
with several different authentication options.
http://spaces.msn.com/sholliday
2/8/2006 entry
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%233LbeOeRGHA.1204@.TK2MSFTNGP12.phx.gbl...
> 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
> <toname@.todomain.com>")
> Mailmsg.From = New System.Net.Mail.MailAddress("From Name
> <fromname@.yourfromdomain.com>")
> Mailmsg.Subject = "(subject text)"
> Try
> Mailmsg.Body = "(message text here)"
> obj.Send(Mailmsg)
> Catch ex As Exception
> Response.Write("Error: " & ex.ToString())
> End Try
> =========================================
Sloan;
Thanks for that response - You pointed me in what I am sure is the right
direction. I am trying to get the web.config settings right for my
environment (Comcast). It seems that comcast does not require authorization
but there must be something else I overlooked as I am getting the following
error;
Mailbox unavailable. The server response was: [PERMFAIL] comcast.net
requires valid sender domain
I am not sure exactly what it wants - I did try my comcast login and PW but
that had no effect?
Wayne
"sloan" <sloan@.ipass.net> wrote in message
news:ONtKcJgRGHA.252@.TK2MSFTNGP10.phx.gbl...
>I have 2.0 example mail code at my blog.
> with several different authentication options.
> http://spaces.msn.com/sholliday
> 2/8/2006 entry
>
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%233LbeOeRGHA.1204@.TK2MSFTNGP12.phx.gbl...
>> 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
>> <toname@.todomain.com>")
>> Mailmsg.From = New System.Net.Mail.MailAddress("From Name
>> <fromname@.yourfromdomain.com>")
>> Mailmsg.Subject = "(subject text)"
>> Try
>> Mailmsg.Body = "(message text here)"
>> obj.Send(Mailmsg)
>> Catch ex As Exception
>> Response.Write("Error: " & ex.ToString())
>> End Try
>> =========================================
>>
>>
I got it working. That last problem was caused by my use of a domain that
had not been activated yet in the From address.
Wayne
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:emOj$4iRGHA.2536@.tk2msftngp13.phx.gbl...
> Sloan;
> Thanks for that response - You pointed me in what I am sure is the right
> direction. I am trying to get the web.config settings right for my
> environment (Comcast). It seems that comcast does not require
> authorization but there must be something else I overlooked as I am
> getting the following error;
> Mailbox unavailable. The server response was: [PERMFAIL] comcast.net
> requires valid sender domain
> I am not sure exactly what it wants - I did try my comcast login and PW
> but that had no effect?
> Wayne
>
> "sloan" <sloan@.ipass.net> wrote in message
> news:ONtKcJgRGHA.252@.TK2MSFTNGP10.phx.gbl...
>>I have 2.0 example mail code at my blog.
>>
>> with several different authentication options.
>>
>> http://spaces.msn.com/sholliday
>>
>> 2/8/2006 entry
>>
>>
>> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
>> news:%233LbeOeRGHA.1204@.TK2MSFTNGP12.phx.gbl...
>>> 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
>>> <toname@.todomain.com>")
>>> Mailmsg.From = New System.Net.Mail.MailAddress("From Name
>>> <fromname@.yourfromdomain.com>")
>>> Mailmsg.Subject = "(subject text)"
>>> Try
>>> Mailmsg.Body = "(message text here)"
>>> obj.Send(Mailmsg)
>>> Catch ex As Exception
>>> Response.Write("Error: " & ex.ToString())
>>> End Try
>>> =========================================
>>>
>>>
>>
>>
0 comments:
Post a Comment