smtpmail.send

G

Guest

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 = "(e-mail address removed)"
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
(e-mail address removed)
]

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(Object obj, String
methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object 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.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
 
G

Guest

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 = "(e-mail address removed)"
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Mail)

....

Bineesh AV said:
where is the TO address


bineesh


kmbarz said:
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 = "(e-mail address removed)"
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
(e-mail address removed)
]

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(Object obj, String
methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object 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.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
 
G

Guest

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 said:
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 = "(e-mail address removed)"
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Mail)

...

Bineesh AV said:
where is the TO address


bineesh


kmbarz said:
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 = "(e-mail address removed)"
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
(e-mail address removed)
]

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(Object obj, String
methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object 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.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top