469,286 Members | 2,539 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,286 developers. It's quick & easy.

send email with VB.NET and exchange

I have an application running on a single workstation (win 2000) with
Outlook installed and a profile create using and exchange server with
authentification through the DNS. This user profile is the only one
using the app.

I want the app to send email using the profile's email adress.

Here is what I am doing :

Dim mail As New MailMessage()
mail.From = "my*******@mydomain.com"
mail.To = "an************@mydomain.com"
mail.Subject = "test msg"
mail.Body = "blablabla"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mydomain.com"
SmtpMail.Send(mail)

The problem is that I get the error message
An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll
Additional information: Could not access 'CDO.Message' object.

I tried changing smtpserver to myexchangeserver.mydomain.com and I get
the same error message.

Any ideas?

Samia.
Jul 19 '05 #1
8 18288
"Samia" <sa*************@hotmail.com> wrote in message
news:1d**************************@posting.google.c om...
I have an application running on a single workstation (win 2000) with
Outlook installed and a profile create using and exchange server with
authentification through the DNS. This user profile is the only one
using the app.

I want the app to send email using the profile's email adress.

Here is what I am doing :

Dim mail As New MailMessage()
mail.From = "my*******@mydomain.com"
mail.To = "an************@mydomain.com"
mail.Subject = "test msg"
mail.Body = "blablabla"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mydomain.com"
SmtpMail.Send(mail)

The problem is that I get the error message
An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll
Additional information: Could not access 'CDO.Message' object.

I tried changing smtpserver to myexchangeserver.mydomain.com and I get
the same error message.

Any ideas?


Look at all of the messages in the exception stack, "Could not access
'CDO.Message' object" is the message in the first exception. That exception
also has an InnerException property which probably references another
exception etc, etc. Keep going until InnerException is null. When you see
all of the messages you'll have a better idea of what's going wrong.

You can also use the ToString() method on an exception and it will build a
string that contains all of the messages.

Jul 19 '05 #2
I tried what you suggested. Doesn't work. I don't get an error message
however. No error message, the code is executed and nothing happens.

here is the code:

Dim iMsg As New CDO.Message()

iMsg.From = "st**********@bonlalum.com"
iMsg.To = "st**********@bonlalum.com"
iMsg.HTMLBody = "samia"
iMsg.Send()

any other ideas???

Thanks

Samia.
"Darshan Mehta" <ob*****@hotmail.com> wrote in message news:<04****************************@phx.gbl>...
The following information was taken off the microsoft
website:

To begin building a new message, first create an instance
of the Message COM class, as shown in the following
example:

[Visual Basic]
'Reference to Microsoft ActiveX Data Objects 2.5 Library
'Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg As New CDO.Message

You can create and send or post a simple message using
only the IMessage interface. To send a Simple Mail
Transfer Protocol (SMTP) message, you must at least set
the To, From and Subject properties on the IMessage
interface. To post a Network News Transfer Protocol
(NNTP) message, you must at least set the
IMessage.Newsgroups and IMessage.Subject properties.

To send a message call the IMessage.Send (SMTP) or
IMessage.Post (NNTP) method

Hope this helps,
Darshan

Jul 19 '05 #3
Samia,

I have the same problem, only doing this from an ASP.Net website. The only
reason I could find for this was the installation of Office XP, which
replaces the reference to the CDO dll on Windows with a newer version (which
in my mind might be the only problem). I haven't found anything to verify my
thoughts, though.

As for the other suggested solution, I've used it, and it works fine. You
have to set the SMTP server on the Configuration of the e-mail message
object:

Dim iMsg As New CDO.Message()

iMsg.From = "st**********@bonlalum.com"
iMsg.To = "st**********@bonlalum.com"
iMsg.HTMLBody = "samia"

iMsg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/se
ndusing"].Value = 2;

iMsg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/sm
tpserverport"].Value = 25;

iMsg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/sm
tpserver"].Value = strMailServer;
iMsg.Configuration.Fields.Update();

iMsg.Send()

Hope this helps

Thys Brits
MCSD/MCAD

"Samia" <sa*************@hotmail.com> wrote in message
news:1d**************************@posting.google.c om...
I have an application running on a single workstation (win 2000) with
Outlook installed and a profile create using and exchange server with
authentification through the DNS. This user profile is the only one
using the app.

I want the app to send email using the profile's email adress.

Here is what I am doing :

Dim mail As New MailMessage()
mail.From = "my*******@mydomain.com"
mail.To = "an************@mydomain.com"
mail.Subject = "test msg"
mail.Body = "blablabla"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mydomain.com"
SmtpMail.Send(mail)

The problem is that I get the error message
An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll
Additional information: Could not access 'CDO.Message' object.

I tried changing smtpserver to myexchangeserver.mydomain.com and I get
the same error message.

Any ideas?

Samia.

Jul 21 '05 #4
"Samia" <sa*************@hotmail.com> wrote in message
news:1d**************************@posting.google.c om...
I have an application running on a single workstation (win 2000) with
Outlook installed and a profile create using and exchange server with
authentification through the DNS. This user profile is the only one
using the app.

I want the app to send email using the profile's email adress.

Here is what I am doing :

Dim mail As New MailMessage()
mail.From = "my*******@mydomain.com"
mail.To = "an************@mydomain.com"
mail.Subject = "test msg"
mail.Body = "blablabla"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mydomain.com"
SmtpMail.Send(mail)

The problem is that I get the error message
An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll
Additional information: Could not access 'CDO.Message' object.

I tried changing smtpserver to myexchangeserver.mydomain.com and I get
the same error message.

Any ideas?


Look at all of the messages in the exception stack, "Could not access
'CDO.Message' object" is the message in the first exception. That exception
also has an InnerException property which probably references another
exception etc, etc. Keep going until InnerException is null. When you see
all of the messages you'll have a better idea of what's going wrong.

You can also use the ToString() method on an exception and it will build a
string that contains all of the messages.

Nov 22 '05 #5
"Samia" <sa*************@hotmail.com> wrote in message
news:1d**************************@posting.google.c om...
I have an application running on a single workstation (win 2000) with
Outlook installed and a profile create using and exchange server with
authentification through the DNS. This user profile is the only one
using the app.

I want the app to send email using the profile's email adress.

Here is what I am doing :

Dim mail As New MailMessage()
mail.From = "my*******@mydomain.com"
mail.To = "an************@mydomain.com"
mail.Subject = "test msg"
mail.Body = "blablabla"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mydomain.com"
SmtpMail.Send(mail)

The problem is that I get the error message
An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll
Additional information: Could not access 'CDO.Message' object.

I tried changing smtpserver to myexchangeserver.mydomain.com and I get
the same error message.

Any ideas?


Look at all of the messages in the exception stack, "Could not access
'CDO.Message' object" is the message in the first exception. That exception
also has an InnerException property which probably references another
exception etc, etc. Keep going until InnerException is null. When you see
all of the messages you'll have a better idea of what's going wrong.

You can also use the ToString() method on an exception and it will build a
string that contains all of the messages.

Nov 22 '05 #6
I tried what you suggested. Doesn't work. I don't get an error message
however. No error message, the code is executed and nothing happens.

here is the code:

Dim iMsg As New CDO.Message()

iMsg.From = "st**********@bonlalum.com"
iMsg.To = "st**********@bonlalum.com"
iMsg.HTMLBody = "samia"
iMsg.Send()

any other ideas???

Thanks

Samia.
"Darshan Mehta" <ob*****@hotmail.com> wrote in message news:<04****************************@phx.gbl>...
The following information was taken off the microsoft
website:

To begin building a new message, first create an instance
of the Message COM class, as shown in the following
example:

[Visual Basic]
'Reference to Microsoft ActiveX Data Objects 2.5 Library
'Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg As New CDO.Message

You can create and send or post a simple message using
only the IMessage interface. To send a Simple Mail
Transfer Protocol (SMTP) message, you must at least set
the To, From and Subject properties on the IMessage
interface. To post a Network News Transfer Protocol
(NNTP) message, you must at least set the
IMessage.Newsgroups and IMessage.Subject properties.

To send a message call the IMessage.Send (SMTP) or
IMessage.Post (NNTP) method

Hope this helps,
Darshan

Nov 22 '05 #7
I tried what you suggested. Doesn't work. I don't get an error message
however. No error message, the code is executed and nothing happens.

here is the code:

Dim iMsg As New CDO.Message()

iMsg.From = "st**********@bonlalum.com"
iMsg.To = "st**********@bonlalum.com"
iMsg.HTMLBody = "samia"
iMsg.Send()

any other ideas???

Thanks

Samia.
"Darshan Mehta" <ob*****@hotmail.com> wrote in message news:<04****************************@phx.gbl>...
The following information was taken off the microsoft
website:

To begin building a new message, first create an instance
of the Message COM class, as shown in the following
example:

[Visual Basic]
'Reference to Microsoft ActiveX Data Objects 2.5 Library
'Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg As New CDO.Message

You can create and send or post a simple message using
only the IMessage interface. To send a Simple Mail
Transfer Protocol (SMTP) message, you must at least set
the To, From and Subject properties on the IMessage
interface. To post a Network News Transfer Protocol
(NNTP) message, you must at least set the
IMessage.Newsgroups and IMessage.Subject properties.

To send a message call the IMessage.Send (SMTP) or
IMessage.Post (NNTP) method

Hope this helps,
Darshan

Nov 22 '05 #8
Samia,

I have the same problem, only doing this from an ASP.Net website. The only
reason I could find for this was the installation of Office XP, which
replaces the reference to the CDO dll on Windows with a newer version (which
in my mind might be the only problem). I haven't found anything to verify my
thoughts, though.

As for the other suggested solution, I've used it, and it works fine. You
have to set the SMTP server on the Configuration of the e-mail message
object:

Dim iMsg As New CDO.Message()

iMsg.From = "st**********@bonlalum.com"
iMsg.To = "st**********@bonlalum.com"
iMsg.HTMLBody = "samia"

iMsg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/se
ndusing"].Value = 2;

iMsg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/sm
tpserverport"].Value = 25;

iMsg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/sm
tpserver"].Value = strMailServer;
iMsg.Configuration.Fields.Update();

iMsg.Send()

Hope this helps

Thys Brits
MCSD/MCAD

"Samia" <sa*************@hotmail.com> wrote in message
news:1d**************************@posting.google.c om...
I have an application running on a single workstation (win 2000) with
Outlook installed and a profile create using and exchange server with
authentification through the DNS. This user profile is the only one
using the app.

I want the app to send email using the profile's email adress.

Here is what I am doing :

Dim mail As New MailMessage()
mail.From = "my*******@mydomain.com"
mail.To = "an************@mydomain.com"
mail.Subject = "test msg"
mail.Body = "blablabla"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mydomain.com"
SmtpMail.Send(mail)

The problem is that I get the error message
An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll
Additional information: Could not access 'CDO.Message' object.

I tried changing smtpserver to myexchangeserver.mydomain.com and I get
the same error message.

Any ideas?

Samia.

Nov 22 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Google Mike | last post: by
3 posts views Thread by icsupt via AccessMonster.com | last post: by
reply views Thread by Just D. | last post: by
9 posts views Thread by Bob Jones | last post: by
3 posts views Thread by Mike B | last post: by
1 post views Thread by michi | last post: by
6 posts views Thread by JIM.H. | last post: by
2 posts views Thread by xx75vulcan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.