Re: Problem with CDO.configuration



Arno R wrote:
"lyle fairfield" <lylefair@xxxxxxxx> schreef in bericht news:Rtgci.103182$Y_.8567@xxxxxxxxxxxxxxxxxxxxx
"Arno R" <arracomn_o_s_p_a_m@xxxxxxxxx> wrote in
news:46717d30$0$25501$ba620dc5@xxxxxxxxxxxxxxxxxxx:

Hi all,
I am sending mail from my apps with CDO nowadays.
However I have one client where this will not work until now.
I am thinking this is related to the provider where the client has his
internet-account. .Item("http://schemas.microsoft.com/cdo/configuration/sendusername";)
= "account here" .From = blabla@xxxxxxx
Some smtp servers seem to require that "account here" and blabla@xxxxxxx be the same string. I beleve one can avoid this difficulty in general by omitting the the line

.From = blabla@xxxxxxx

in which case FROM will default to
sendusername
but it's been a long time since I wrote code that used CDO, and I may be recalling things that never happened.

--
lyle fairfield

Unfortunately the above solution did not work so...
To (try to) solve my problem I created a gmail-account and I tried to use gmail as external smtp-server.
(I found some info o that by Googling)
I came across the initial errormessages by using port 465 and a ssl connection like in :

with objFields
...
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 455 .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl";) = "true"
end with

smtpusessl takes a true/false value not a string. Here is some *working* code I've used. Note that some lines might wrap:

'------------------
' --- CDO Defines (e.g. using GMAIL) :

Private Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Private Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Private Const cdoAnonymous = 0 'Do not authenticate
Private Const cdoBasic = 1 ' basic (clear-text) authentication
Private Const cdoNTLM = 2 ' NTLM

Private Const cdoMailSMTP_Server As String = "smtp.gmail.com"
Private Const cdoMailSMTP_Port As Long = 465

Public Function sendCDO_Mail(sTo As String, sSubject As String, sMsg As String) As Boolean
On Error GoTo errHandler

Dim objMessage As Object, sUserID As String, sPassword As String

sUserID = Nz(DLookup("[cdoMailUserID]", "tblSettings"), "") ' set your user id here
sPassword = Nz(DLookup("[cdoMailPassword]", "tblSettings"), "") ' set your password here

If Len(sUserID) > 0 Then
Set objMessage = CreateObject("CDO.Message")

With objMessage
.Subject = sSubject
.From = sUserID ' required field
.To = sTo
.TextBody = sMsg

'==This section provides the configuration information for the remote SMTP server.

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

' Name or IP of Remote SMTP Server

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = cdoMailSMTP_Server

' Type of authentication, NONE, Basic (Base64 encoded), NTLM

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";) = cdoBasic

' Your UserID on the SMTP server

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername";) = sUserID

' Your password on the SMTP server

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword";) = sPassword

' Server port (typically 25) - gmail uses 587 or 465

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = cdoMailSMTP_Port

' Use SSL for the connection (False or True)

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl";) = True

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout";) = 180

.Configuration.Fields.Update
'==End remote SMTP server configuration section==

.Send

sendCDO_Mail = True
End With
End If

Exit Function

errHandler:

Dim nErr As Long, sErr As String
nErr = Err.Number
sErr = Err.Description

Debug.Print "Error in sendCDO_Mail: " & nErr & " - " & sErr

End Function
'------------------------

Good luck!

--
'--------------------------
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft Access MVP
'--------------------------
.



Relevant Pages

  • Re: CDO SDNI connection not authorized
    ... a way that I can get the SMTP Server by using code. ... The actual string is ... After that I started to use CDO and I searched around and found some SMTP ... When I was running IIS servvices on my work station I could send ...
    (comp.databases.ms-access)
  • RE: Using cdo in MS Access VBA to automate email
    ... Also keep in mind cdo does not exist in Access 2007. ... strMessage As String, _ ... Dim objSession As MAPI.Session ... Dim objAttach As Attachment ...
    (microsoft.public.access.modulesdaovba)
  • Re: Read Exchange Emails
    ... 1- CDO 1.21 is not supported in the managed .NET framework. ... The transport error code was 0x800ccc15. ... > CultureInfo culture, String[] namedParameters) ... > String methodName, Objectargs) ...
    (microsoft.public.win32.programmer.messaging)
  • Re: SMTP Email VB.net 2008
    ... Private Sub Button1_Click(ByVal sender As System.Object, ... Public Sub SendSimpleMail(ByVal FromAddr As String, ... Dim Client As SmtpClient ... you should also check if your SMTP server ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Remote instantiation of CDONTS.NewMail
    ... This method works great if you have a local SMTP server. ... attempt to access a remote SMTP server. ... When I run the same procedure directly on the target ... > How do I send e-mail with CDO? ...
    (microsoft.public.scripting.vbscript)