Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: CDO error 80040213

559 views
Skip to first unread message

mpaigni

unread,
Jan 7, 2012, 8:16:55 AM1/7/12
to
Hello -- PROBLEM SOLVED with error message 80040213 and CDO!!!

I was struggling with this specific problem for the past day. What worked for me (Windows XP with Excel 2003 VBA 6) was the reply no13 in the next forum:
http://www.vbforums.com/showthread.php?t=551463&highlight=cdo.message+gmail

Allow me to repeat the code by westcon1.
I think the difference is that in this example from, to etc are instantiated before the options (smtp stuff) (weird) and no need to load the Options object with the default settings. Perhaps a question to Ron Debruin could give a professional answer, but I do not have time to look it thoroughly.


Set objmessage = CreateObject("CDO.Message")
objmessage.Subject = "Example CDO Message"
objmessage.From = "m...@my.com"
objmessage.To = "me" ' sent to myself, not at gmail
objmessage.TextBody = "This is some sample message text."

objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2


'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

'Your UserID on the SMTP server
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "usernm"

'Your password on the SMTP server
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass"

'Name or IP of Remote SMTP Server
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
'Server port (typically 25)
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
'Use SSL for the connection (False or True)
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
objmessage.Configuration.Fields.Update


objmessage.Send
Set objmessage = Nothing


Regards
SHARE THE KNOWLEDGE
SHARE THE FUN



> On Friday, August 24, 2007 2:26 PM KentuckyError wrote:

> I'm getting this error trying to send mail from a form. All the googled
> answers say it's a problem with the smtp server. This is not my problem. I
> have 40 other workstations and this identical code works fine. I set up an
> outlook express email test to make sure there wasn't a strange client-side
> firewall issue. The outllok express mail sent fine. I can't get it to work
> inside of the access module. any advice you can provide is much appreciated.
> The code is below, but I know the code works fine on 40 computers. just not
> this one.
>
> sch = "http://schemas.microsoft.com/cdo/configuration/"
> Set cdoconfig = CreateObject("CDO.Configuration")
> With cdoconfig.Fields
> .Item(sch & "sendusing") = 2
> .Item(sch & "smtpserver") = "<my smtp server>"
> .Item(sch & "smtpauthenticate") = cdoBasic
> .Item(sch & "sendusername") = "<my username>"
> .Item(sch & "sendpassword") = "<my password>"
> .Update
> End With
>
> Set cdoMessage = CreateObject("CDO.Message")
> Set cdoMessage.Configuration = cdoconfig
> cdoMessage.From = "<my email>"
> cdoMessage.To = "<their email>"
> cdoMessage.Subject = "<my subject>"
> cdoMessage.TextBody = "<my body>"
> cdoMessage.Send
> Set cdoMessage = Nothing
> Set cdoconfig = Nothing


>> On Sunday, August 26, 2007 12:34 PM Ron Weiner wrote:

>> Have you tried turning off the firewall on the affected computer?
>>
>> Ron W


>>> On Monday, August 27, 2007 9:48 AM KentuckyError wrote:

>>> yup. I shut the firewall off completely and I still get the error. I also
>>> used the server to send messages with outlook express, so I know there is
>>> nothing funny going on with that port if the firewall was one. This has
>>> stumped me for weeks.
>>>
>>> "Ron Weiner" wrote:


>>>> On Monday, August 27, 2007 5:18 PM Tony Toews [MVP] wrote:

>>>> KentuckyErrors <Kentuck...@discussions.microsoft.com> wrote:
>>>>
>>>>
>>>> Here's an interesting thread suggesting trying sendusing = 1 if a
>>>> local SMTP server.
>>>>
>>>> http://groups.google.ca/group/microsoft.public.inetserver.iis.smtp_nntp/browse_thread/thread/456f3eb4e4c3a926/eee62d5afc121737?lnk=st&q=CDO+error+80040213&rnum=2&hl=en#eee62d5afc121737
>>>>
>>>> Otherwise I'd suggest searching at Google Groups using the following
>>>> URL.
>>>>
>>>> http://groups.google.com/groups/search?hl=en&ie=UTF-8&oe=UTF-8&q=CDO+error+80040213&qt_s=Search+Groups
>>>>
>>>> Tony
>>>> --
>>>> Tony Toews, Microsoft Access MVP
>>>> Please respond only in the newsgroups so that others can
>>>> read the entire thread of messages.
>>>> Microsoft Access Links, Hints, Tips & Accounting Systems at
>>>> http://www.granite.ab.ca/accsmstr.htm
>>>> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/



0 new messages