By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

System.Web.HttpException: Could not access 'CDO.Message' object

P: n/a
Hi,

I have ab ASP.Net Application in which I need to send e-mail on button
click. Even though my C# code for that is correct.I am getting the following
error:: I think the following error can be bcoz of the SMTP virtual server. I
cant view the SMTP virtual server in IIS. How to correct this error???

Send failure: System.Web.HttpException: Could not access 'CDO.Message'
object. ---> System.Reflection.TargetInvocationException: Exception has been
thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x8004020F): The server rejected
one or more recipient addresses. The server response was: 550 5.7.1 Unable to
relay for ir*@trio.com --- End of inner exception stack trace --- at
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters) at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) --- End of inner exception stack trace --- at
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage
message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at
BofLog.Details.btnMail_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\demo\boflog\details.aspx.cs:lin e 224

My code is:

private void btnMail_Click(object sender, System.EventArgs e)
{

System.Web.Mail.MailMessage objEmail = new System.Web.Mail.MailMessage();
objEmail.To = "ir*@trio.com";
objEmail.From ="ir*@trio.com";
objEmail.Subject = "New LOG";
objEmail.Body = "<h4> NEW LOG </h4>
<br><center><h3>LOG</h3></center><br> <br> <table border=1 width=80%
align=center> <tr> <td><b>Label1.Text</b></td><td>" + txtCompany.Text +"</td>
<td> </td> <td>Label2.Text</td> <td>" + txtActivationDate.Text +"</td>
<td> </td> <td>Label3.Text</td> <td>" + txtRegion.Text +"</td></tr> <tr>
<td><b>Label4.Text</b></td><td>" + txtSim.Text +"</td> <td> </td>
<td>Label5.Text</td> <td>" + txtPiae.Text +"</td> <td> </td>
<td>Label6.Text</td> <td>" + txtPiaeRepID.Text +"</td></tr> <tr>
<td><b>Label7.Text</b></td><td>" + txtDirectRep.Text +"</td> <td> </td>
<td>Label8.Text</td> <td>" + txtCompanyRepID.Text +"</td> <td> </td>
<td>Label9.Text</td> <td>" + txtChannelMgr.Text +"</td></tr> <tr>
<td><b>Label10.Text</b></td><td>" + txtSubAgent.Text +"</td> <td> </td>
<td>Label11.Text</td> <td>" + txtCustomer.Text +"</td> <td> </td>
<td>Label12.Text</td> <td>" + txtAccount.Text +"</td></tr> <tr>
<td><b>Label13.Text</b></td><td>" + txtUser.Text +"</td> <td> </td>
<td>Label14.Text</td> <td>" + rblProvision.SelectedValue +"</td> <td> </td>
<td>Label15.Text</td> <td>" + txtMrc.Text +"</td></tr> <tr>
<td><b>Label16.Text</b></td><td>" + txtp2kOrder.Text +"</td> <td> </td>
<td>Label17.Text</td> <td>" + txtMin.Text +"</td> <td> </td>
<td>Label18.Text</td> <td>" + txtAsiOrder.Text +"</td></tr> <tr>
<td><b>Label19.Text</b></td><td>" + txtTracking.Text +"</td> <td> </td>
<td>Label20.Text</td> <td>" + txtEsn.Text +"</td> <td> </td>
<td>Label21.Text</td> <td>" + txtVerified.Text +"</td></tr> <tr>
<td>Label22.Text</td> <td>" + txtCustServiceRep.Text +"</td></tr></table>";
objEmail.Priority = System.Web.Mail.MailPriority.High;

objEmail.BodyFormat = System.Web.Mail.MailFormat.Html;
System.Web.Mail.SmtpMail.SmtpServer= "localhost";
try
{
System.Web.Mail.SmtpMail.Send(objEmail);
Response.Redirect("WebForm2.aspx");
}
catch (Exception exc)
{
Response.Write("Send failure: " + exc.ToString());
}
}

pmud
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi PMUD

If you use the local smtp don't make a roundtrip thru the network - use the
pickup dir

MailMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]
= 1;
MailMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"]
= ((_"C:\\Inetpub\\mailroot\\Pickup";

--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
Hi,

I have ab ASP.Net Application in which I need to send e-mail on button
click. Even though my C# code for that is correct.I am getting the
following
error:: I think the following error can be bcoz of the SMTP virtual
server. I
cant view the SMTP virtual server in IIS. How to correct this error???

Send failure: System.Web.HttpException: Could not access 'CDO.Message'
object. ---> System.Reflection.TargetInvocationException: Exception has
been
thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x8004020F): The server
rejected
one or more recipient addresses. The server response was: 550 5.7.1 Unable
to
relay for ir*@trio.com --- End of inner exception stack trace --- at
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters) at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) --- End of inner exception stack trace --- at
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) at
System.Web.Mail.CdoSysHelper.Send(MailMessage
message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at
BofLog.Details.btnMail_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\demo\boflog\details.aspx.cs:lin e 224

My code is:

private void btnMail_Click(object sender, System.EventArgs e)
{

System.Web.Mail.MailMessage objEmail = new System.Web.Mail.MailMessage();
objEmail.To = "ir*@trio.com";
objEmail.From ="ir*@trio.com";
objEmail.Subject = "New LOG";
objEmail.Body = "<h4> NEW LOG </h4>
<br><center><h3>LOG</h3></center><br> <br> <table border=1 width=80%
align=center> <tr> <td><b>Label1.Text</b></td><td>" + txtCompany.Text
+"</td>
<td> </td> <td>Label2.Text</td> <td>" + txtActivationDate.Text +"</td>
<td> </td> <td>Label3.Text</td> <td>" + txtRegion.Text +"</td></tr> <tr>
<td><b>Label4.Text</b></td><td>" + txtSim.Text +"</td> <td> </td>
<td>Label5.Text</td> <td>" + txtPiae.Text +"</td> <td> </td>
<td>Label6.Text</td> <td>" + txtPiaeRepID.Text +"</td></tr> <tr>
<td><b>Label7.Text</b></td><td>" + txtDirectRep.Text +"</td> <td> </td>
<td>Label8.Text</td> <td>" + txtCompanyRepID.Text +"</td> <td> </td>
<td>Label9.Text</td> <td>" + txtChannelMgr.Text +"</td></tr> <tr>
<td><b>Label10.Text</b></td><td>" + txtSubAgent.Text +"</td> <td> </td>
<td>Label11.Text</td> <td>" + txtCustomer.Text +"</td> <td> </td>
<td>Label12.Text</td> <td>" + txtAccount.Text +"</td></tr> <tr>
<td><b>Label13.Text</b></td><td>" + txtUser.Text +"</td> <td> </td>
<td>Label14.Text</td> <td>" + rblProvision.SelectedValue +"</td> <td>
</td>
<td>Label15.Text</td> <td>" + txtMrc.Text +"</td></tr> <tr>
<td><b>Label16.Text</b></td><td>" + txtp2kOrder.Text +"</td> <td> </td>
<td>Label17.Text</td> <td>" + txtMin.Text +"</td> <td> </td>
<td>Label18.Text</td> <td>" + txtAsiOrder.Text +"</td></tr> <tr>
<td><b>Label19.Text</b></td><td>" + txtTracking.Text +"</td> <td> </td>
<td>Label20.Text</td> <td>" + txtEsn.Text +"</td> <td> </td>
<td>Label21.Text</td> <td>" + txtVerified.Text +"</td></tr> <tr>
<td>Label22.Text</td> <td>" + txtCustServiceRep.Text
+"</td></tr></table>";
objEmail.Priority = System.Web.Mail.MailPriority.High;

objEmail.BodyFormat = System.Web.Mail.MailFormat.Html;
System.Web.Mail.SmtpMail.SmtpServer= "localhost";
try
{
System.Web.Mail.SmtpMail.Send(objEmail);
Response.Redirect("WebForm2.aspx");
}
catch (Exception exc)
{
Response.Write("Send failure: " + exc.ToString());
}
}

pmud

Nov 19 '05 #2

P: n/a
Both the links you gave me are not working. Can you please suggest smthg else?

thanks

"Daniel Fisher(lennybacon)" wrote:
Hi PMUD

If you use the local smtp don't make a roundtrip thru the network - use the
pickup dir

MailMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]
= 1;
MailMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"]
= ((_"C:\\Inetpub\\mailroot\\Pickup";

--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
Hi,

I have ab ASP.Net Application in which I need to send e-mail on button
click. Even though my C# code for that is correct.I am getting the
following
error:: I think the following error can be bcoz of the SMTP virtual
server. I
cant view the SMTP virtual server in IIS. How to correct this error???

Send failure: System.Web.HttpException: Could not access 'CDO.Message'
object. ---> System.Reflection.TargetInvocationException: Exception has
been
thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x8004020F): The server
rejected
one or more recipient addresses. The server response was: 550 5.7.1 Unable
to
relay for ir*@trio.com --- End of inner exception stack trace --- at
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters) at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) --- End of inner exception stack trace --- at
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) at
System.Web.Mail.CdoSysHelper.Send(MailMessage
message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at
BofLog.Details.btnMail_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\demo\boflog\details.aspx.cs:lin e 224

My code is:

private void btnMail_Click(object sender, System.EventArgs e)
{

System.Web.Mail.MailMessage objEmail = new System.Web.Mail.MailMessage();
objEmail.To = "ir*@trio.com";
objEmail.From ="ir*@trio.com";
objEmail.Subject = "New LOG";
objEmail.Body = "<h4> NEW LOG </h4>
<br><center><h3>LOG</h3></center><br> <br> <table border=1 width=80%
align=center> <tr> <td><b>Label1.Text</b></td><td>" + txtCompany.Text
+"</td>
<td> </td> <td>Label2.Text</td> <td>" + txtActivationDate.Text +"</td>
<td> </td> <td>Label3.Text</td> <td>" + txtRegion.Text +"</td></tr> <tr>
<td><b>Label4.Text</b></td><td>" + txtSim.Text +"</td> <td> </td>
<td>Label5.Text</td> <td>" + txtPiae.Text +"</td> <td> </td>
<td>Label6.Text</td> <td>" + txtPiaeRepID.Text +"</td></tr> <tr>
<td><b>Label7.Text</b></td><td>" + txtDirectRep.Text +"</td> <td> </td>
<td>Label8.Text</td> <td>" + txtCompanyRepID.Text +"</td> <td> </td>
<td>Label9.Text</td> <td>" + txtChannelMgr.Text +"</td></tr> <tr>
<td><b>Label10.Text</b></td><td>" + txtSubAgent.Text +"</td> <td> </td>
<td>Label11.Text</td> <td>" + txtCustomer.Text +"</td> <td> </td>
<td>Label12.Text</td> <td>" + txtAccount.Text +"</td></tr> <tr>
<td><b>Label13.Text</b></td><td>" + txtUser.Text +"</td> <td> </td>
<td>Label14.Text</td> <td>" + rblProvision.SelectedValue +"</td> <td>
</td>
<td>Label15.Text</td> <td>" + txtMrc.Text +"</td></tr> <tr>
<td><b>Label16.Text</b></td><td>" + txtp2kOrder.Text +"</td> <td> </td>
<td>Label17.Text</td> <td>" + txtMin.Text +"</td> <td> </td>
<td>Label18.Text</td> <td>" + txtAsiOrder.Text +"</td></tr> <tr>
<td><b>Label19.Text</b></td><td>" + txtTracking.Text +"</td> <td> </td>
<td>Label20.Text</td> <td>" + txtEsn.Text +"</td> <td> </td>
<td>Label21.Text</td> <td>" + txtVerified.Text +"</td></tr> <tr>
<td>Label22.Text</td> <td>" + txtCustServiceRep.Text
+"</td></tr></table>";
objEmail.Priority = System.Web.Mail.MailPriority.High;

objEmail.BodyFormat = System.Web.Mail.MailFormat.Html;
System.Web.Mail.SmtpMail.SmtpServer= "localhost";
try
{
System.Web.Mail.SmtpMail.Send(objEmail);
Response.Redirect("WebForm2.aspx");
}
catch (Exception exc)
{
Response.Write("Send failure: " + exc.ToString());
}
}

pmud


Nov 19 '05 #3

P: n/a
the message means that the smtp server is unable to relay the message, it
should be in the dead letter folder. you will need to configure the virtual
smtp server to be able to talk to a functioning smtp server. find the setup
info for the smtp server you want the virtual one to relay to, then confire
the smtp server in iis manager
-- bruce (sqlwork.com)


"pmud" <pm**@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
| Hi,
|
| I have ab ASP.Net Application in which I need to send e-mail on button
| click. Even though my C# code for that is correct.I am getting the
following
| error:: I think the following error can be bcoz of the SMTP virtual
server. I
| cant view the SMTP virtual server in IIS. How to correct this error???
|
| Send failure: System.Web.HttpException: Could not access 'CDO.Message'
| object. ---> System.Reflection.TargetInvocationException: Exception has
been
| thrown by the target of an invocation. --->
| System.Runtime.InteropServices.COMException (0x8004020F): The server
rejected
| one or more recipient addresses. The server response was: 550 5.7.1 Unable
to
| relay for ir*@trio.com --- End of inner exception stack trace --- at
| System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
| Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
| String[] namedParameters) at System.RuntimeType.InvokeMember(String name,
| BindingFlags invokeAttr, Binder binder, Object target, Object[] args,
| ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
| at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
| methodName, Object[] args) --- End of inner exception stack trace --- at
| System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
| methodName, Object[] args) at
System.Web.Mail.CdoSysHelper.Send(MailMessage
| message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at
| BofLog.Details.btnMail_Click(Object sender, EventArgs e) in
| c:\inetpub\wwwroot\demo\boflog\details.aspx.cs:lin e 224
|
| My code is:
|
| private void btnMail_Click(object sender, System.EventArgs e)
| {
|
| System.Web.Mail.MailMessage objEmail = new System.Web.Mail.MailMessage();
| objEmail.To = "ir*@trio.com";
| objEmail.From ="ir*@trio.com";
| objEmail.Subject = "New LOG";
| objEmail.Body = "<h4> NEW LOG </h4>
| <br><center><h3>LOG</h3></center><br> <br> <table border=1 width=80%
| align=center> <tr> <td><b>Label1.Text</b></td><td>" + txtCompany.Text
+"</td>
| <td> </td> <td>Label2.Text</td> <td>" + txtActivationDate.Text +"</td>
| <td> </td> <td>Label3.Text</td> <td>" + txtRegion.Text +"</td></tr> <tr>
| <td><b>Label4.Text</b></td><td>" + txtSim.Text +"</td> <td> </td>
| <td>Label5.Text</td> <td>" + txtPiae.Text +"</td> <td> </td>
| <td>Label6.Text</td> <td>" + txtPiaeRepID.Text +"</td></tr> <tr>
| <td><b>Label7.Text</b></td><td>" + txtDirectRep.Text +"</td> <td> </td>
| <td>Label8.Text</td> <td>" + txtCompanyRepID.Text +"</td> <td> </td>
| <td>Label9.Text</td> <td>" + txtChannelMgr.Text +"</td></tr> <tr>
| <td><b>Label10.Text</b></td><td>" + txtSubAgent.Text +"</td> <td> </td>
| <td>Label11.Text</td> <td>" + txtCustomer.Text +"</td> <td> </td>
| <td>Label12.Text</td> <td>" + txtAccount.Text +"</td></tr> <tr>
| <td><b>Label13.Text</b></td><td>" + txtUser.Text +"</td> <td> </td>
| <td>Label14.Text</td> <td>" + rblProvision.SelectedValue +"</td> <td>
</td>
| <td>Label15.Text</td> <td>" + txtMrc.Text +"</td></tr> <tr>
| <td><b>Label16.Text</b></td><td>" + txtp2kOrder.Text +"</td> <td> </td>
| <td>Label17.Text</td> <td>" + txtMin.Text +"</td> <td> </td>
| <td>Label18.Text</td> <td>" + txtAsiOrder.Text +"</td></tr> <tr>
| <td><b>Label19.Text</b></td><td>" + txtTracking.Text +"</td> <td> </td>
| <td>Label20.Text</td> <td>" + txtEsn.Text +"</td> <td> </td>
| <td>Label21.Text</td> <td>" + txtVerified.Text +"</td></tr> <tr>
| <td>Label22.Text</td> <td>" + txtCustServiceRep.Text
+"</td></tr></table>";
| objEmail.Priority = System.Web.Mail.MailPriority.High;
|
| objEmail.BodyFormat = System.Web.Mail.MailFormat.Html;
| System.Web.Mail.SmtpMail.SmtpServer= "localhost";
| try
| {
| System.Web.Mail.SmtpMail.Send(objEmail);
| Response.Redirect("WebForm2.aspx");
| }
| catch (Exception exc)
| {
| Response.Write("Send failure: " + exc.ToString());
| }
| }
|
| pmud
Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.