Home All Groups Group Topic Archive Search About

access denied to CDO.Message

Author
21 Feb 2005 10:25 AM
Pooja

Hi,

I have developed a windows application for our client, which informs
passengers thru email regarding a schedule change of flights. When i tested
it at my end, using their SMTP server, the mails were being sent but when
application was installed at client's place, using the same SMTP server,
mails are not being sent. I'm getting an error message - 

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
(0x80040220): The "SendUsing" configuration value is invalid.


My code -

-----------------*******************--------------------------

SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
MailMessage mailMessage = new MailMessage();
mailMessage.BodyFormat = MailFormat.Html ;
mailMessage.From = fromEmailId;
mailMessage.To = toEmailId;
mailMessage.Subject = subject;
mailMessage.Body = body;

mailMessage.Headers.Add("Reply-To",reply_to);
mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pwd);

SmtpMail.Send(mailMessage);

-----------------*******************--------------------------

Please help me out with this. It's urgent.

Thanks and Regards,
Pooja.
Author
21 Feb 2005 10:45 AM
Jakob Christensen
Your first line of code looks weird.  SmtpMail.SmtpServer is just a string so
I really do not know what you are trying to do.  Your code results in an
empty string for SmtpMail.SmtpServer, so it will try to send the mail using
the local SMTP server.  Change the code to:

SmtpMail.SmtpServer = smtpServerName;

HTH, Jakob.


Show quoteHide quote
"Pooja" wrote:

> Hi,
>
> I have developed a windows application for our client, which informs
> passengers thru email regarding a schedule change of flights. When i tested
> it at my end, using their SMTP server, the mails were being sent but when
> application was installed at client's place, using the same SMTP server,
> mails are not being sent. I'm getting an error message - 
>
> 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
> (0x80040220): The "SendUsing" configuration value is invalid.
>
>
> My code -
>
> -----------------*******************--------------------------
>
> SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
> MailMessage mailMessage = new MailMessage();
> mailMessage.BodyFormat = MailFormat.Html ;
> mailMessage.From = fromEmailId;
> mailMessage.To = toEmailId;
> mailMessage.Subject = subject;
> mailMessage.Body = body;
>            
> mailMessage.Headers.Add("Reply-To",reply_to);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pwd);
>
> SmtpMail.Send(mailMessage);
>
> -----------------*******************--------------------------
>
> Please help me out with this. It's urgent.
>
> Thanks and Regards,
> Pooja.
Author
21 Feb 2005 12:05 PM
Pooja
Hi,

Thanx for replying. Actually i'm reading SMTP Server Name from the
configuration settings in the first line of my code. Just changed that line
while copy pasting here. Originally it looks like -
SmtpMail.SmtpServer.Insert(0,System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_Name"]);

Please help me now.

Thanks and Regards,
Pooja.

Show quoteHide quote
"Jakob Christensen" wrote:

> Your first line of code looks weird.  SmtpMail.SmtpServer is just a string so
> I really do not know what you are trying to do.  Your code results in an
> empty string for SmtpMail.SmtpServer, so it will try to send the mail using
> the local SMTP server.  Change the code to:
>
> SmtpMail.SmtpServer = smtpServerName;
>
> HTH, Jakob.
>
>
> "Pooja" wrote:
>
> > Hi,
> >
> > I have developed a windows application for our client, which informs
> > passengers thru email regarding a schedule change of flights. When i tested
> > it at my end, using their SMTP server, the mails were being sent but when
> > application was installed at client's place, using the same SMTP server,
> > mails are not being sent. I'm getting an error message - 
> >
> > 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
> > (0x80040220): The "SendUsing" configuration value is invalid.
> >
> >
> > My code -
> >
> > -----------------*******************--------------------------
> >
> > SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
> > MailMessage mailMessage = new MailMessage();
> > mailMessage.BodyFormat = MailFormat.Html ;
> > mailMessage.From = fromEmailId;
> > mailMessage.To = toEmailId;
> > mailMessage.Subject = subject;
> > mailMessage.Body = body;
> >            
> > mailMessage.Headers.Add("Reply-To",reply_to);
> >
> > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
> >
> > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
> >
> > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
> >
> > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pwd);
> >
> > SmtpMail.Send(mailMessage);
> >
> > -----------------*******************--------------------------
> >
> > Please help me out with this. It's urgent.
> >
> > Thanks and Regards,
> > Pooja.
Author
21 Feb 2005 12:13 PM
Jakob Christensen
My point is that the following code will set SmtpMail.SmtpServer to the empty
string (hence it will use the local smtp server):

SmtpMail.SmtpServer.Insert(0,
System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_Name"]);

Instead you should use:

SmtpMail.SmtpServer =
System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_Name"];

Regards, Jakob.


Show quoteHide quote
"Pooja" wrote:

> Hi,
>
> Thanx for replying. Actually i'm reading SMTP Server Name from the
> configuration settings in the first line of my code. Just changed that line
> while copy pasting here. Originally it looks like -
>
> SmtpMail.SmtpServer.Insert(0,System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_Name"]);
>
> Please help me now.
>
> Thanks and Regards,
> Pooja.
>
> "Jakob Christensen" wrote:
>
> > Your first line of code looks weird.  SmtpMail.SmtpServer is just a string so
> > I really do not know what you are trying to do.  Your code results in an
> > empty string for SmtpMail.SmtpServer, so it will try to send the mail using
> > the local SMTP server.  Change the code to:
> >
> > SmtpMail.SmtpServer = smtpServerName;
> >
> > HTH, Jakob.
> >
> >
> > "Pooja" wrote:
> >
> > > Hi,
> > >
> > > I have developed a windows application for our client, which informs
> > > passengers thru email regarding a schedule change of flights. When i tested
> > > it at my end, using their SMTP server, the mails were being sent but when
> > > application was installed at client's place, using the same SMTP server,
> > > mails are not being sent. I'm getting an error message - 
> > >
> > > 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
> > > (0x80040220): The "SendUsing" configuration value is invalid.
> > >
> > >
> > > My code -
> > >
> > > -----------------*******************--------------------------
> > >
> > > SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
> > > MailMessage mailMessage = new MailMessage();
> > > mailMessage.BodyFormat = MailFormat.Html ;
> > > mailMessage.From = fromEmailId;
> > > mailMessage.To = toEmailId;
> > > mailMessage.Subject = subject;
> > > mailMessage.Body = body;
> > >            
> > > mailMessage.Headers.Add("Reply-To",reply_to);
> > >
> > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
> > >
> > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
> > >
> > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
> > >
> > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pwd);
> > >
> > > SmtpMail.Send(mailMessage);
> > >
> > > -----------------*******************--------------------------
> > >
> > > Please help me out with this. It's urgent.
> > >
> > > Thanks and Regards,
> > > Pooja.
Author
21 Feb 2005 12:49 PM
Pooja
Hi,

It's still giving the same error. Do you think that on the machine from
where mail is being sent, Dafault SMTP Virtaul Server needs to be configured?

Thanks and Regards,
Pooja.

Show quoteHide quote
"Jakob Christensen" wrote:

> My point is that the following code will set SmtpMail.SmtpServer to the empty
> string (hence it will use the local smtp server):
>
> SmtpMail.SmtpServer.Insert(0,
> System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_Name"]);
>
> Instead you should use:
>
> SmtpMail.SmtpServer =
> System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_Name"];
>
> Regards, Jakob.
>
>
> "Pooja" wrote:
>
> > Hi,
> >
> > Thanx for replying. Actually i'm reading SMTP Server Name from the
> > configuration settings in the first line of my code. Just changed that line
> > while copy pasting here. Originally it looks like -
> >
> > SmtpMail.SmtpServer.Insert(0,System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_Name"]);
> >
> > Please help me now.
> >
> > Thanks and Regards,
> > Pooja.
> >
> > "Jakob Christensen" wrote:
> >
> > > Your first line of code looks weird.  SmtpMail.SmtpServer is just a string so
> > > I really do not know what you are trying to do.  Your code results in an
> > > empty string for SmtpMail.SmtpServer, so it will try to send the mail using
> > > the local SMTP server.  Change the code to:
> > >
> > > SmtpMail.SmtpServer = smtpServerName;
> > >
> > > HTH, Jakob.
> > >
> > >
> > > "Pooja" wrote:
> > >
> > > > Hi,
> > > >
> > > > I have developed a windows application for our client, which informs
> > > > passengers thru email regarding a schedule change of flights. When i tested
> > > > it at my end, using their SMTP server, the mails were being sent but when
> > > > application was installed at client's place, using the same SMTP server,
> > > > mails are not being sent. I'm getting an error message - 
> > > >
> > > > 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
> > > > (0x80040220): The "SendUsing" configuration value is invalid.
> > > >
> > > >
> > > > My code -
> > > >
> > > > -----------------*******************--------------------------
> > > >
> > > > SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
> > > > MailMessage mailMessage = new MailMessage();
> > > > mailMessage.BodyFormat = MailFormat.Html ;
> > > > mailMessage.From = fromEmailId;
> > > > mailMessage.To = toEmailId;
> > > > mailMessage.Subject = subject;
> > > > mailMessage.Body = body;
> > > >            
> > > > mailMessage.Headers.Add("Reply-To",reply_to);
> > > >
> > > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
> > > >
> > > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
> > > >
> > > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
> > > >
> > > > mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pwd);
> > > >
> > > > SmtpMail.Send(mailMessage);
> > > >
> > > > -----------------*******************--------------------------
> > > >
> > > > Please help me out with this. It's urgent.
> > > >
> > > > Thanks and Regards,
> > > > Pooja.
Author
21 Feb 2005 4:39 PM
Sreejath S. Warrier
Hello Pooja,
just guessing here.  I see that you are reading the SMTP Server name from
the config file.
While deploying, have you changed the server name to match the production
SMTP Server?
Regards,
Sreejath
Show quoteHide quote
> Hi,
>
> It's still giving the same error. Do you think that on the machine
> from where mail is being sent, Dafault SMTP Virtaul Server needs to be
> configured?
>
> Thanks and Regards,
> Pooja.
> "Jakob Christensen" wrote:
>
>> My point is that the following code will set SmtpMail.SmtpServer to
>> the empty string (hence it will use the local smtp server):
>>
>> SmtpMail.SmtpServer.Insert(0,
>> System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_N
>> ame"]);
>>
>> Instead you should use:
>>
>> SmtpMail.SmtpServer =
>> System.Configuration.ConfigurationSettings.AppSettings["SMTP_Server_N
>> ame"];
>>
>> Regards, Jakob.
>>
>> "Pooja" wrote:
>>
>>> Hi,
>>>
>>> Thanx for replying. Actually i'm reading SMTP Server Name from the
>>> configuration settings in the first line of my code. Just changed
>>> that line while copy pasting here. Originally it looks like -
>>>
>>> SmtpMail.SmtpServer.Insert(0,System.Configuration.ConfigurationSetti
>>> ngs.AppSettings["SMTP_Server_Name"]);
>>>
>>> Please help me now.
>>>
>>> Thanks and Regards,
>>> Pooja.
>>> "Jakob Christensen" wrote:
>>>
>>>> Your first line of code looks weird.  SmtpMail.SmtpServer is just a
>>>> string so I really do not know what you are trying to do.  Your
>>>> code results in an empty string for SmtpMail.SmtpServer, so it will
>>>> try to send the mail using the local SMTP server.  Change the code
>>>> to:
>>>>
>>>> SmtpMail.SmtpServer = smtpServerName;
>>>>
>>>> HTH, Jakob.
>>>>
>>>> "Pooja" wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have developed a windows application for our client, which
>>>>> informs passengers thru email regarding a schedule change of
>>>>> flights. When i tested it at my end, using their SMTP server, the
>>>>> mails were being sent but when application was installed at
>>>>> client's place, using the same SMTP server, mails are not being
>>>>> sent. I'm getting an error message -
>>>>>
>>>>> 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 (0x80040220): The
>>>>> "SendUsing" configuration value is invalid.
>>>>>
>>>>> My code -
>>>>>
>>>>> -----------------*******************--------------------------
>>>>>
>>>>> SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
>>>>> MailMessage mailMessage = new MailMessage();
>>>>> mailMessage.BodyFormat = MailFormat.Html ;
>>>>> mailMessage.From = fromEmailId;
>>>>> mailMessage.To = toEmailId;
>>>>> mailMessage.Subject = subject;
>>>>> mailMessage.Body = body;
>>>>> mailMessage.Headers.Add("Reply-To",reply_to);
>>>>>
>>>>> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configura
>>>>> tion/smtpconnectiontimeout", 60);
>>>>>
>>>>> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configura
>>>>> tion/smtpauthenticate", "1");
>>>>>
>>>>> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configura
>>>>> tion/sendusername", username);
>>>>>
>>>>> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configura
>>>>> tion/sendpassword", pwd);
>>>>>
>>>>> SmtpMail.Send(mailMessage);
>>>>>
>>>>> -----------------*******************--------------------------
>>>>>
>>>>> Please help me out with this. It's urgent.
>>>>>
>>>>> Thanks and Regards,
>>>>> Pooja.
Author
21 Feb 2005 4:07 PM
Joël Descombes
Every time I seen this message it is because the message body wasn't conform
with the SMTP specifications. Even if it doesn't seem to be that I suggest to
look around that for exemples the carriage returns...

Joel Descombes

Show quoteHide quote
"Pooja" wrote:

> Hi,
>
> I have developed a windows application for our client, which informs
> passengers thru email regarding a schedule change of flights. When i tested
> it at my end, using their SMTP server, the mails were being sent but when
> application was installed at client's place, using the same SMTP server,
> mails are not being sent. I'm getting an error message - 
>
> 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
> (0x80040220): The "SendUsing" configuration value is invalid.
>
>
> My code -
>
> -----------------*******************--------------------------
>
> SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
> MailMessage mailMessage = new MailMessage();
> mailMessage.BodyFormat = MailFormat.Html ;
> mailMessage.From = fromEmailId;
> mailMessage.To = toEmailId;
> mailMessage.Subject = subject;
> mailMessage.Body = body;
>            
> mailMessage.Headers.Add("Reply-To",reply_to);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pwd);
>
> SmtpMail.Send(mailMessage);
>
> -----------------*******************--------------------------
>
> Please help me out with this. It's urgent.
>
> Thanks and Regards,
> Pooja.
Author
23 Feb 2005 1:02 PM
Carlos J. Quintero [.NET MVP]
See the errors FAQ of http://systemwebmail.com/

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com


Show quoteHide quote
"Pooja" <Po***@discussions.microsoft.com> escribió en el mensaje
news:59D50EB7-EA02-4772-B3F3-B8CD849BBC1B@microsoft.com...
> Hi,
>
> I have developed a windows application for our client, which informs
> passengers thru email regarding a schedule change of flights. When i
> tested
> it at my end, using their SMTP server, the mails were being sent but when
> application was installed at client's place, using the same SMTP server,
> mails are not being sent. I'm getting an error message -
>
> 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
> (0x80040220): The "SendUsing" configuration value is invalid.
>
>
> My code -
>
> -----------------*******************--------------------------
>
> SmtpMail.SmtpServer.Insert(0,["SMTP_Server_Name"]);
> MailMessage mailMessage = new MailMessage();
> mailMessage.BodyFormat = MailFormat.Html ;
> mailMessage.From = fromEmailId;
> mailMessage.To = toEmailId;
> mailMessage.Subject = subject;
> mailMessage.Body = body;
>
> mailMessage.Headers.Add("Reply-To",reply_to);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout",
> 60);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
> "1");
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
> username);
>
> mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
> pwd);
>
> SmtpMail.Send(mailMessage);
>
> -----------------*******************--------------------------
>
> Please help me out with this. It's urgent.
>
> Thanks and Regards,
> Pooja.