Thursday, March 22, 2012

smtpmail.send

I'm trying to expand my horizons here by working through an ASP.Net book.
When I do the example that uses:

Line 55: Mail.From = "feedback@dotnet.itags.org.graymad.com"
Line 56: SmtpMail.SmtpServer = "localhost"
Line 57: SmtpMail.Send(Mail)

I get:

[COMException (0x8004020f): The server rejected one or more recipient
addresses. The server response was: 550 5.7.1 Unable to relay for
myemail@dotnet.itags.org.comcast.net
]

Since both my code and the code from the book failed, I'm assuming there's
something else I need to configure? I show SMTP running under services so
there must be something else I need to do here. The remainder of the
exception follows. Thanks

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) +111
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1861
System.Web.Mail.SmtpMail.Send(MailMessage message) +153
Chapter_08.SmtpEmail.Button1_Click(Object sender, EventArgs e) in
C:\Microsoft Press\ASPNETSBS\Chapter_08\SmtpEmail.aspx.vb:57
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292Sorry, here's a little more detail:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' Create MailMessage instance, set properties, and send
Dim Mail As New MailMessage

Mail.To = TextBox1.Text
Mail.Cc = TextBox2.Text
Mail.Bcc = TextBox3.Text
Mail.Subject = TextBox4.Text
Mail.Body = TextBox5.Text

' Set the property below to a valid email address
Mail.From = "kmbarz@.comcast.net"
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Mail)

...

"Bineesh AV" wrote:

> where is the TO address
>
> bineesh
>
> "kmbarz" <kmbarz@.discussions.microsoft.com> wrote in message
> news:E895C022-9FDF-49E4-8541-73F371D6D082@.microsoft.com...
> > I'm trying to expand my horizons here by working through an ASP.Net book.
> > When I do the example that uses:
> > Line 55: Mail.From = "feedback@.graymad.com"
> > Line 56: SmtpMail.SmtpServer = "localhost"
> > Line 57: SmtpMail.Send(Mail)
> > I get:
> > [COMException (0x8004020f): The server rejected one or more recipient
> > addresses. The server response was: 550 5.7.1 Unable to relay for
> > myemail@.comcast.net
> > ]
> > Since both my code and the code from the book failed, I'm assuming there's
> > something else I need to configure? I show SMTP running under services so
> > there must be something else I need to do here. The remainder of the
> > exception follows. Thanks
> > [TargetInvocationException: Exception has been thrown by the target of an
> > invocation.]
> > System.RuntimeType.InvokeDispMethod(String name, BindingFlags
> invokeAttr,
> > Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
> > String[] namedParameters) +0
> > System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
> > Binder binder, Object target, Object[] args, ParameterModifier[]
> modifiers,
> > CultureInfo culture, String[] namedParameters) +473
> > System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
> > methodName, Object[] args) +58
> > [HttpException (0x80004005): Could not access 'CDO.Message' object.]
> > System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
> > methodName, Object[] args) +111
> > System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1861
> > System.Web.Mail.SmtpMail.Send(MailMessage message) +153
> > Chapter_08.SmtpEmail.Button1_Click(Object sender, EventArgs e) in
> > C:\Microsoft Press\ASPNETSBS\Chapter_08\SmtpEmail.aspx.vb:57
> > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
> stBackEvent(String eventArgument) +57
> > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
> > sourceControl, String eventArgument) +18
> > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
> > System.Web.UI.Page.ProcessRequestMain() +1292
>
hi,
the possible reason could be that your mail server is not configured to
relay messages from your smtp server or you or the from address does not have
permissions to relay messages. Make sure your mail server allows relaying of
messages from your smtp server or instead try SmtpMail.SmtpServer = ""
instead of localhost and check if it works

--
HTH
srini
http://www.expertszone.com

"kmbarz" wrote:

> Sorry, here's a little more detail:
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> ' Create MailMessage instance, set properties, and send
> Dim Mail As New MailMessage
> Mail.To = TextBox1.Text
> Mail.Cc = TextBox2.Text
> Mail.Bcc = TextBox3.Text
> Mail.Subject = TextBox4.Text
> Mail.Body = TextBox5.Text
> ' Set the property below to a valid email address
> Mail.From = "kmbarz@.comcast.net"
> SmtpMail.SmtpServer = "localhost"
> SmtpMail.Send(Mail)
> ...
> "Bineesh AV" wrote:
> > where is the TO address
> > bineesh
> > "kmbarz" <kmbarz@.discussions.microsoft.com> wrote in message
> > news:E895C022-9FDF-49E4-8541-73F371D6D082@.microsoft.com...
> > > I'm trying to expand my horizons here by working through an ASP.Net book.
> > > When I do the example that uses:
> > > > Line 55: Mail.From = "feedback@.graymad.com"
> > > Line 56: SmtpMail.SmtpServer = "localhost"
> > > Line 57: SmtpMail.Send(Mail)
> > > > I get:
> > > > [COMException (0x8004020f): The server rejected one or more recipient
> > > addresses. The server response was: 550 5.7.1 Unable to relay for
> > > myemail@.comcast.net
> > > ]
> > > > Since both my code and the code from the book failed, I'm assuming there's
> > > something else I need to configure? I show SMTP running under services so
> > > there must be something else I need to do here. The remainder of the
> > > exception follows. Thanks
> > > > > > [TargetInvocationException: Exception has been thrown by the target of an
> > > invocation.]
> > > System.RuntimeType.InvokeDispMethod(String name, BindingFlags
> > invokeAttr,
> > > Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
> > > String[] namedParameters) +0
> > > System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
> > > Binder binder, Object target, Object[] args, ParameterModifier[]
> > modifiers,
> > > CultureInfo culture, String[] namedParameters) +473
> > > System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
> > > methodName, Object[] args) +58
> > > > [HttpException (0x80004005): Could not access 'CDO.Message' object.]
> > > System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
> > > methodName, Object[] args) +111
> > > System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1861
> > > System.Web.Mail.SmtpMail.Send(MailMessage message) +153
> > > Chapter_08.SmtpEmail.Button1_Click(Object sender, EventArgs e) in
> > > C:\Microsoft Press\ASPNETSBS\Chapter_08\SmtpEmail.aspx.vb:57
> > > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> > > > System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
> > stBackEvent(String eventArgument) +57
> > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
> > > sourceControl, String eventArgument) +18
> > > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
> > > System.Web.UI.Page.ProcessRequestMain() +1292

0 comments:

Post a Comment