Send emails by calling SMTP Server directly

JohnPapa

Registered User.
Local time
Today, 11:55
Joined
Aug 15, 2010
Messages
1,043
I can use MS Access to send emails using an email client like MS Outlook.

I could not find any way for MS Access to send emails directly to the SMTP server, essentially bypassing MS Outlook or any other email client.

Is this possible?
 
I tried the following, but unfortunately does not send. The xxx, were replaced for valid email addresses.

It tells me "The transport failed to connect to the server"

What should I put in

config.Fields(cdoSMTPServer).value

Should I put the Outgoing Server of my ISP? I believe I placed the correct server name.

Code:
    Dim mail    As CDO.message
    Dim config  As CDO.Configuration
  
    Set mail = CreateObject("CDO.Message")
    Set config = CreateObject("CDO.Configuration")
  
    config.Fields(cdoSendUsingMethod).value = cdoSendUsingPort
    config.Fields(cdoSMTPServer).value = "xxx"
    config.Fields(cdoSMTPServerPort).value = 587   '25
    config.Fields.update
  
    Set mail.Configuration = config
  
    With mail
        .To = "xxx@xxx.org"
        .From = "xxx@xxx.com"
        .Subject = "First email with CDO"
        .TextBody = "This is the body of the first plain text email with CDO."
      
        '.AddAttachment "C:\path\to\a\file.dat"
      
        .send
    End With
  
    Set config = Nothing
    Set mail = Nothing
 
Some SMTP servers require authentication before allowing a connection. Research in this direction.
 
Some SMTP servers require authentication before allowing a connection. Research in this direction.
Will look into what you mention.

I tried to send an email using ISP icdSoft. I used

Code:
    config.Fields(cdoSendUsingMethod).value = cdoSendUsingPort
    config.Fields(cdoSMTPServer).value = "mail.s427.sureserver.com"
    config.Fields(cdoSMTPServerPort).value = 587
    config.Fields.update

icdSoft specifies the following

Incoming and outgoing serverProtocolPortInformation
mail.s427.sureserver.comIMAPS993IMAP with SSL/TLS encryption
POP3S995POP3 with SSL/TLS encryption
SMTP587Supports SSL/TLS encryption with STARTTLS
SMTPS465SMTP with SSL/TLS encryption
 
@isladogs dogs has a CDO Email tester app

 
@isladogs dogs has a CDO Email tester app

I downloaded the example you mention, I ran it. Nothing happens when I click on any of the buttons "Send Email", "Help", "Quit"
 
Works for me, just using Plain Text as it initially loads??
 
No warnings. I will check the trusted location.
It was a problem with the trusted location. I would have expected a message. It now gives one of the errors which appear in the documentation.
 

Users who are viewing this thread

Back
Top Bottom