Re: Problem with CDO.configuration
- From: John Mishefske <jmishefskeNO@xxxxxxxxxxxxx>
- Date: Sat, 16 Jun 2007 22:31:07 -0500
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,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
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
.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
'--------------------------
.
- Follow-Ups:
- Re: Problem with CDO.configuration
- From: Arno R
- Re: Problem with CDO.configuration
- References:
- Problem with CDO.configuration
- From: Arno R
- Re: Problem with CDO.configuration
- From: lyle fairfield
- Re: Problem with CDO.configuration
- From: Arno R
- Problem with CDO.configuration
- Prev by Date: Re: Setting up an automatic but customized ID
- Next by Date: Re: Add records in multi-user environment
- Previous by thread: Re: Problem with CDO.configuration
- Next by thread: Re: Problem with CDO.configuration
- Index(es):
Relevant Pages
|