Sending mail in VBA using cdoSMTPUseSSL

As of this morning my internet provider has stopped accepting plain SMTP relay and requires SSL. I've tried to adapt my VBA (MS Access) code, but can't get it working. It used to work just fine with SSL=False.

Dim objConfig  As CDO.Configuration
Dim objMessage  As CDO.Message
Dim Fields      As ADODB.Fields

    Set objMessage = CreateObject("CDO.Message")
    Set objConfig = CreateObject("CDO.Configuration")
    Set Fields = objConfig.Fields
    
    With Fields
         .Item(cdoSendUsingMethod) = cdoSendUsingPort
         .Item(cdoSMTPServer) = "my.mailserver.out"
         .Item(cdoSMTPServerPort) = 465 ' I also tried 25
         .Item(cdoSMTPUseSSL) = true
         If l_MailServer.UserName <> "" Then
             .Item(cdoSMTPAuthenticate) = cdoBasic
             .Item(cdoSendUserName) = "username"
             .Item(cdoSendPassword) = "password"
         End If
         .Update
    End With
    
    Set objMessage.Configuration = objConfig
    With objMessage
        .To = l_TO
        .From = l_FROM
        If l_CC <> "" Then .CC = l_CC
        If l_BCC <> "" Then .BCC = l_BCC
        .Subject = l_Subj
        .TextBody = l_Body
        .Send
    End With

Open in new window


Do I need to do something with certificates? I'm stumped.

thanks,
Michiel
altiplanoAsked:
Who is Participating?
 
altiplanoAuthor Commented:
I ended up implementing the EASendMail SMTP component from AdminSystem Software Ltd
Costs $150 and works almost out-of-the-box.
regards,
Michiel
0
 
altiplanoAuthor Commented:
If anyone knows a different way or component to send mail from VBA using SSL, than that's fine as well.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.