473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

The "SendUsing" configuration value is invalid / HttpException (0x80004005): Could not access 'CDO.Message' object

lds
I am getting the following error:

The "SendUsing" configuration value is invalid.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x80040220): The "SendUsing" configuration value is
invalid.
]

[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) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1846
System.Web.Mail.SmtpMail.Send(MailMessage message) +153
CAWAA.E.NeedHelp.btnSubmit_Click(Object sender, EventArgs e) +580
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() +1292
Here is the code:

Dim objMailMessage As New MailMessage
objMailMessage.BodyFormat = MailFormat.Html
objMailMessage.From = "bl****@bla.ca"
objMailMessage.Subject = "Form Title"
objMailMessage.Body = strMessage

If Len(strEmailFrom) > 0 Then
strEmailTo += ";" & strEmailFrom
End If

objMailMessage.To = strEmailTo
SmtpMail.SmtpServer = "127.0.0.1"
SmtpMail.Send(objMailMessage)
This works on our testing server which uses a network service, but it
does not work on our production server which does not. Any ideas? I
know about the FAQ site System.WEb.Mail, OH MY!, and we have tried all
of their suggestions and none of them work.

Nov 19 '05 #1
5 15086
Smtp.SendUsing = 2

Nov 19 '05 #2
lds

sp3d2orbit wrote:
Smtp.SendUsing = 2

When I enter in the code you suggested it cannot be compiled in Visual
Studio .NET 2003. it gives me the following error:

Name 'smtp' is not declared

I have imported System.Web.Mail only. Should I be importing something
else as well?

Nov 19 '05 #3
If you upgrade to 2005 you probably won't have this problem. Here's a
sample of sending email from .NET 2.0:

MailMessage msg = new MailMessage();
msg.From = new MailAddress("te**@test.com");
msg.To.Add("te**@test.com");
msg.Subject = "test subject";
msg.Body = "test body";

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.yourdomain.com";
smtp.Send(msg);

But, if you want to continue using CDO.Message (which MailMessage in <
..NET 2.0 wraps) you need to set the SendUsing property to 2. I have no
idea how to set it from .NET but here's some sample C++ code to get you
started:

#import <msado15.dll> no_namespace rename("EOF", "adoEOF")
#import <cdosys.dll> rename_namespace("CDO") rename("EOF", "adoEOF")

....

CDO::IMessagePtr pMail = NULL;
pMail.CreateInstance(__uuidof(CDO::Message));

pMail->put_To("te**@test.com");
pMail->put_From("te**@test.com");
pMail->put_Subject("test subject");
pMail->put_TextBody("test body");

CDO::IConfigurationPtr pConfig(__uuidof(CDO::Configuration));
FieldsPtr pFields = pConfig->GetFields();
pFields->Item["http://schemas.microsoft.com/cdo/configuration/smtpserver"]->Value

=
_variant_t("smtp.yourdomain.com"); pFields->Item["http://schemas.microsoft.com/cdo/configuration/smtpserverport"]->Value
= _variant_t((long)25);
pFields->Item["http://schemas.microsoft.com/cdo/configuration/sendusing"]->Value
= _variant_t(2);
pFields->Update();

pMail->Configuration = pConfig;
pMail->Send();

The most important line is the one that sets the SendUsing property to
2.

Best of luck,
Matt Furnari

Nov 19 '05 #4
OK, here's some c# code that works for me.

MailMessage msg = new MailMessage();
msg.To = "te**@test.com";
msg.From = "te**@test.com";
msg.Subject = "test subject";
msg.Body = "test body";
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"]
= 25;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"]
= "smtp.yourdomain.com";
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]
= 2;
SmtpMail.SmtpServer = "smtp.yourdomain.com";
SmtpMail.Send(msg);

Translating it into VB should be as simple as changing the first line.
Sorry it tooks so long, I'm normally a c++ developer not a .NET
developer.

Best of luck,

Matt Furnari

Nov 19 '05 #5
Sure this won't matter, but I use:

SmtpMail.SmtpServer = "localhost"

Is your SMTP server configured and working on your production server?

Have you added 127.0.0.1 to the unresticted list for relaying? (AFAIR, I ran
into this problem when I switched from Win2K to WinXP for my development
machine). Not sure if the same thing applies for Win2003 Server or not....

IIS->Default SMTP->Properties->Access tab->Relay button.

Greg
"lds" <li**********@gnb.ca> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I am getting the following error:

The "SendUsing" configuration value is invalid.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x80040220): The "SendUsing" configuration value is
invalid.
]

[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) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1846
System.Web.Mail.SmtpMail.Send(MailMessage message) +153
CAWAA.E.NeedHelp.btnSubmit_Click(Object sender, EventArgs e) +580
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() +1292
Here is the code:

Dim objMailMessage As New MailMessage
objMailMessage.BodyFormat = MailFormat.Html
objMailMessage.From = "bl****@bla.ca"
objMailMessage.Subject = "Form Title"
objMailMessage.Body = strMessage

If Len(strEmailFrom) > 0 Then
strEmailTo += ";" & strEmailFrom
End If

objMailMessage.To = strEmailTo
SmtpMail.SmtpServer = "127.0.0.1"
SmtpMail.Send(objMailMessage)
This works on our testing server which uses a network service, but it
does not work on our production server which does not. Any ideas? I
know about the FAQ site System.WEb.Mail, OH MY!, and we have tried all
of their suggestions and none of them work.

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brian Morris | last post by:
I'm new to .NET and just trying a few things out, like emailing. I created a form in Visual Studio .Net to input some information for generating an email and I'm getting the following error when it...
1
by: CK | last post by:
Hi All, I have this problem when try to send a mail by Using CDO.Message. I got the info from the web, said it may the problem where, the IIS SMTP setup incorrectly. My question is How i can know...
2
by: Brent | last post by:
Hi, I have a C# asp.net app that sent mail fine on server 2000 or win 2000, but now I moved it to our new 2003 box, and it's giving me "The 'SendUsing' configuration is invalid" This is the code...
1
by: Elie | last post by:
Hello I get this error when the code runs from the server as an .asp page or from a compiled dll. But When I log onto the server and run a vb program that executes the same code, it works...
1
by: Benny Ng | last post by:
Dear All, Now I just finished my winform application. And a part of that is to send email reminder to the users. It's working fine in the server that with SMTP service in Windows 2003. But now...
1
by: samarthkumar84 | last post by:
Hi I had used following code for sending e-mail but facing this problem. I want to send this e-mail in ASP.NET using VB.NET code. I am attaching both code an output. CODE Imports...
1
by: groupie | last post by:
Hi, I'd like to know how to implement the "Forgot Password" feature on many websites which require a login, exactly like this ebay example:...
1
by: yimma216 | last post by:
Hi, we have a vbscript. However it is not working for the application at all. Am i missing something here? <object runat="server" scope="application" id="mailcongid"...
0
by: Raahul | last post by:
I am using asp with vbscript. for sending mail CDO object is used but giving transport errror 0x80040217. But the same code is running on live in another server. I am using the port 25,also having...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.