CDO EMail Tester (1 Viewer)

Status
Not open for further replies.

isladogs

CID VIP
Local time
Today, 07:52
Joined
Jan 14, 2017
Messages
15,661
Attached is a simple utility for testing the settings for sending emails from Access using collaborative data objects (CDO).

The zip file contains the Access utility (.accdb) & a Word help file (.docx)
I've had to zip it as the site won't allow uploading of docx files!

If the email fails due to incorrect settings, the Word doc explains what the error code means so it can be fixed.

To use this utility copy the database & Word doc into the same folder

Any comments welcomed.

I have included all error codes I have experienced, but if anyone using this gets another code, please do let me know

EDIT 02/10/2018
This version only works in 32-bit Access
Updated version in post #3 works in both 32-bit & 64-bit Access
 

Attachments

  • EMail Tester.zip
    180.3 KB · Views: 1,063
Last edited:

Ksabai

Registered User.
Local time
Yesterday, 23:52
Joined
Jul 31, 2017
Messages
104
Re: EMail Tester

I have a 64Bit Access, unable to run as iam getting PtrSafe Error while compiling
 

isladogs

CID VIP
Local time
Today, 07:52
Joined
Jan 14, 2017
Messages
15,661
Apologies - thought I'd sorted that out before I uploaded it last year
Updated version attached which works in both 32-bit & 64-bit Access
 

Attachments

  • EMailTester v1810.zip
    194 KB · Views: 685
Last edited:

isladogs

CID VIP
Local time
Today, 07:52
Joined
Jan 14, 2017
Messages
15,661
Following an question via PM by AWF member ellenr, I've discovered a new issue sending email using CDO using a GMail account
Google has added additional security which effectively blocks email sent from any app it considers less secure (including Outlook and Access).
This results in an incorrect password error when you enter your correct account details.

There are two possible solutions both of which require a change in the security section of your Google account settings:
a) allow less secure apps - if this is applied, GMail will again work via CDO.
However, this is not available if you have switched on two step authentication

b) set app password = enter a name for the app e.g. CDOEMailTester and it will generate a unique password for that app and your account.
Enter that in place of your usual password & CDO email for your GMail account will again work perfectly!

See these links for more info:
a) https://support.google.com/accounts/answer/6010255?hl=en&ref_topic=7188673#
b) https://support.google.com/accounts/answer/185833?hl=en

Updated app to v1903 with new help file - both attached
 

Attachments

  • CDOEMailTester v1903.zip
    213.2 KB · Views: 509
Last edited:

isladogs

CID VIP
Local time
Today, 07:52
Joined
Jan 14, 2017
Messages
15,661
Something I’ve been meaning to do for a long time
I’ve just updated my CDO Email Tester to include HTML Email as well as plain text.

Unzip the attached file & keep all files in the same folder
If you use HTML email, it will automatically include formatted text and an inline image.



Hope this is of use to others
 

Attachments

  • CDO EMail Tester v1908.zip
    393.7 KB · Views: 590
  • Capture.PNG
    Capture.PNG
    73.9 KB · Views: 1,336

isladogs

CID VIP
Local time
Today, 07:52
Joined
Jan 14, 2017
Messages
15,661
Further update to version 2201
Many thanks to AWF member @alvingenius for alerting me to an issue with non-Latin scripts such as Arabic / Chinese not displaying properly as these require the use of UTF-8 characters
Even better, he provided the code changes needed to fix that issue!

The solution was to add encoding instructions in 2 procedures:

a) Add one line to SendEMaIlCDO procedure (plain text emails)
Rich (BB code):
With Message
        .To = aTo                                  
        .Subject = aSubject                       
        .TextBody = aTextBody                      
        .BodyPart.Charset = "UTF-8"                 'fixes issues with e.g. use of Arabic text in Subject and body
        If Len(aCC) > 0 Then .CC = aCC            
        If Len(aFrom) > 0 Then .From = aFrom       
        If Len(aPath) > 0 Then .AddAttachment (aPath) 
        .Send    '
End With


a) Add two lines to SendHTMLEMaIlCDO procedure (HTML emails)
Rich (BB code):
With Message
        .To = aTo                                   
        .Subject = aSubject                        
        .HTMLBody = aTextBody                       
        .BodyPart.Charset = "UTF-8"         'fixes issues with e.g. use of Arabic text in Subject
        .HTMLBodyPart.Charset = "UTF-8"       'fixes issues with e.g. use of Arabic text in HTML Body
        If Len(aCC) > 0 Then .CC = aCC             
        If Len(aFrom) > 0 Then .From = aFrom       
        If Len(aPath) > 0 Then .AddAttachment (aPath) 
        .Send    'Send the message
End With

The updated version containing these changes is attached .... or it can be downloaded from my website
 

Attachments

  • CDO EMail Tester v2201.zip
    389.1 KB · Views: 15
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom