Computer Learning Zone CLZ Access Excel Word Windows

The learning process continues until the day you die

-Kirk Douglas
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Seminars > Email > Lessons >
Back to Email Seminar Lessons    Comments List
Pinned    Upload Images   @Reply   Bookmark    Link   Email  
Using TLS instead of SSL
Richard Rost 
          
7 months ago
For those of you who need to use TLS for your mail server instead of SSL, here's some code from ChatGPT which you may find useful. I have not tried this myself, as I've never needed to use anything other than SSL:

I've been using Sendgrid with Microsoft Access for literally a decade, and I have never had to use TLS. I'm just using straight SMTP with an API key and port 465. However, a quick query of GPT gives me this:

In Microsoft Access VBA, when sending an email via SMTP using CDO, you need to set the appropriate configuration fields to enable TLS instead of SSL. TLS is often referred to as "STARTTLS" in SMTP configurations. Below is an example configuration for enabling TLS:

CodeSub SendEmailWithTLS()
    Dim objMessage As Object
    Dim objConfig As Object
    Dim Fields As Object
    
    ' Create the email object
    Set objMessage = CreateObject("CDO.Message")
    Set objConfig = CreateObject("CDO.Configuration")
    Set Fields = objConfig.Fields
    
    ' Configure the SMTP server settings
    With Fields
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.example.com" ' Replace with your SMTP server
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 ' Port for TLS
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' cdoSendUsingPort
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 ' Basic Authentication
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "your_username" ' Your email username
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "your_password" ' Your email password
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False ' Disable SSL
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusetls") = True ' Enable TLS
        .Update
    End With

    ' Configure the email message
    With objMessage
        Set .Configuration = objConfig
        .To = "[email protected]" ' Replace with recipient email
        .From = "[email protected]" ' Replace with sender email
        .Subject = "Test Email with TLS"
        .TextBody = "This is a test email sent using TLS."
        .Send
    End With
    
    ' Clean up
    Set objMessage = Nothing
    Set objConfig = Nothing
    Set Fields = Nothing
    
    MsgBox "Email sent successfully using TLS."
End Sub


Key Points:
1. TLS Port: Port `587` is typically used for TLS. Ensure your SMTP server supports this port.
2. Disable SSL: The `.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")` property should be set to `False` for TLS.
3. Enable TLS: Use `.Item("http://schemas.microsoft.com/cdo/configuration/smtpusetls") = True` to explicitly enable TLS.

If your email provider does not specifically require `.smtpusetls`, using port `587` with `.smtpusessl = True` often negotiates TLS automatically. Ensure the server supports the protocol and authentication method you are trying to use.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Email Seminar Lessons.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/14/2025 5:14:49 PM. PLT: 1s