Email using CDO

D

Daniel

I am using the following code:

Dim ObjetoMail As Object

' Create CDO object
Set ObjetoMail = CreateObject("CDO.Message")

' Configura email
ObjetoMail.To = "someoneelsesemailaddress"
ObjetoMail.From = "myemailaddress"
ObjetoMail.Subject = "The subject"
ObjetoMail.HTMLBody = "I'm the body of the <b>message</b>"

' Sending mail
ObjetoMail.Send

' Destroying CDO
Set ObjetoMail = Nothing

And I get the following error 'The "SendUsing"configuration value is invalid
- -2147220960 (80040220)'

1. Could someone provide me with the proper code to work from?
2. How can I get help files for CDO? I have access to the library but no
help to work with, is this normal?

Thank you,

Daniel
 
T

td

Hello Daniel
Do you have "Send on Behalf" permission for that mail account?
Cannot help with other questions
td
 
D

Daniel

td,

It is my account so I should have full perms. and I am an Admin on the PC
itself (if that has any impact).

Daniel
 
D

Daniel

td,

Some more info should it be helpful: I am running outlook 2003 directly on
the PC and do not use an exchange server. The account itself is a POP3/STMP
mail account.

Daniel
 
T

td

Just because you own the account does not mean you have access. I am not sure
where MS's security kicks in. We have an Exchange server so I cannot say
whether Outlook does the blocking or whether the issue gets as far as the
Exchange server before the block occurs. I have several email accounts, many
redundant for public disemmination and have to give "on behalf permission" to
be able to use them but this may be Exchange although the permission is
handled at Outlook level.

It may be useful to post this query on the Outlook forum. I am sure there
would be many people there who could answer that question.
td
 
R

Rick Brandt

Daniel said:
I am using the following code:

Dim ObjetoMail As Object

' Create CDO object
Set ObjetoMail = CreateObject("CDO.Message")

' Configura email
ObjetoMail.To = "someoneelsesemailaddress"
ObjetoMail.From = "myemailaddress"
ObjetoMail.Subject = "The subject"
ObjetoMail.HTMLBody = "I'm the body of the <b>message</b>"

' Sending mail
ObjetoMail.Send

' Destroying CDO
Set ObjetoMail = Nothing

And I get the following error 'The "SendUsing"configuration value is
invalid - -2147220960 (80040220)'

1. Could someone provide me with the proper code to work from?
2. How can I get help files for CDO? I have access to the library
but no help to work with, is this normal?

Thank you,

Daniel

You have to create and use a configuration object to use CDO. In my CDO
class object I have...

Private Sub Class_Initialize()
Set iCfg = CreateObject("CDO.Configuration")
With iCfg
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "mailbox.mydomain.com"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
.Fields.Update
End With
Set iMsg = CreateObject("CDO.Message")
End Sub

Sub SendMail()

With iMsg
Set .Configuration = iCfg
etc...
 

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

Similar Threads


Top