Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Sending mail in VBA using cdoSMTPUseSSL

Posted on 2012-08-13
Medium Priority
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
  • 2

Author Comment

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

Accepted Solution

altiplano earned 0 total points
ID: 38288388
I ended up implementing the EASendMail SMTP component from AdminSystem Software Ltd
Costs $150 and works almost out-of-the-box.

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
When we develop an application in Ms Access 2016 we should also try to protect the queries, macros and table links. I know I may not have a permanent solution but for novice users, they will not manage to break your application. Below is the detail …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

577 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