Sending mail in VBA using cdoSMTPUseSSL

Posted on 2012-08-13
Last Modified: 2012-08-13
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
    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
    End With

Open in new window

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

Question by:altiplano

    Author Comment

    If anyone knows a different way or component to send mail from VBA using SSL, than that's fine as well.

    Accepted Solution

    I ended up implementing the EASendMail SMTP component from AdminSystem Software Ltd
    Costs $150 and works almost out-of-the-box.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now