[dba-VB] CDO Email

jwcolby jwcolby at colbyconsulting.com
Fri May 23 18:03:51 CDT 2008


Folks,

I was recently dernaged enough to stop using outlook (which 
worked just fine, but was a ROYAL PITA to move from computer 
to computer) and start using Thunderbird.

Now...

I need to use CDO to send my mail (I guess).  I have a bit 
of an issue in that I use an SMTP "mail forwarder" to send 
my email, to get around port 25 blocking.

I have found three different pieces of code, none of which 
"just work", in fact none of them work at all.

Function mCDOSendMail()
Dim objMessage As CDO.Message
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "jwcolby at colbyconsulting.com"
objMessage.To = "jwcolby at colbyconsulting.com"
objMessage.TextBody = "This is some sample message text."
objMessage.Send
End Function

the above code gives me an error "The send using 
configuration is invalid".


Sub CDO_Mail_Small_Text()
     Dim iMsg As Object
     Dim iConf As Object
     Dim strbody As String



     Set iMsg = CreateObject("CDO.Message")
     Set iConf = CreateObject("CDO.Configuration")

     iConf.Load -1    ' CDO Source Defaults
     Dim Flds As Variant
     Set Flds = iConf.Fields
     With Flds
 
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") 
= 2
 
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") 
_
                        = "smtp-auth.no-ip.com"
 
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") 
= 3325
         .Update
     End With

     strbody = "Hi there"
     With iMsg
         Set .Configuration = iConf
         .To = "jwcolby at colbyconsulting.com"
         .CC = ""
         .BCC = ""
         .From = """John"" <jwcolby at colbyconsulting.com>"
         .Subject = "Important message"
         .TextBody = strbody
         .Send
     End With
End Sub

The above code gives me:

"The server rejected one or more recipient addresses.  The 
server response was 554 5.7.1 <unknown[97.82.150.214]>: 
client host rejected: Access denied"

This looks like SOMETHING is happening.  smtp-auth.no-ip.com 
is MY email forwarder.

The problem here is that all of these examples give NO 
explanation of anything that is happening.  Like what in the 
heck is all the HTTP://schemas crap?  Why is it going to 
microsoft.com?  Am I supposed to change that?  If so to what?

Wouldn't it be nice if just ONE TIME example code would 
actually tell you what you need to know to use it?

Can anyone help me with this stuff?

Thanks,

-- 
John W. Colby
www.ColbyConsulting.com



More information about the dba-VB mailing list