[AccessD] [dba-VB] CDO Email

Eric Barro ebarro at verizon.net
Sat May 24 11:05:54 CDT 2008


When you send via your forwarding SMTP server using Thunderbird are you
sending (via the email client) authentication? I have to assume that most
SMTP servers today expect both username and password to authenticate before
they even allow you to send mail out via the SMTP service.

There's a setting for authentication that you need to send.

	
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenti
cate", 1);	' set to authenticate
	
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername
", uxSMTPUser.Text);	'send the smtp username
	
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword
", uxSMTPPassword.Text); 	'send the smtp password

You can adapt that .NET code for your use.

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Friday, May 23, 2008 4:04 PM
To: Access Developers discussion and problem solving; VBA
Subject: [dba-VB] CDO Email

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
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the AccessD mailing list