Results 1 to 12 of 12
  1. #1
    Theof is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2019
    Posts
    8

    CDO Email Not Working

    Hello everyone. I am having much difficulty getting emails to send via CDO from a Hotmail/Outllok address. I have the correct SMTP settings but I keep getting different errors such as "The transport failed to connect to the server". Another error is "The server rejected the sender address."



    From what I understand, Hotmail's SMTP server requires STARTTLS. To this end, I have included the 'SendTLS' in the CDO config.

    I have attached a small sample Access DB that has a form and a module to accomplish this. Please help me take a look. It's driving me insane.

    NB: please note that the hotmail address that I want to send from in the sample app (parallax@outlook.com) is fictitious.

    All help is appreciated. Thanks.

    Click image for larger version. 

Name:	CDO Error - The Transport failed to connect to the server - 2.JPG 
Views:	30 
Size:	47.1 KB 
ID:	43219 Click image for larger version. 

Name:	CDO Error - Server rejected Sender Address.JPG 
Views:	29 
Size:	69.5 KB 
ID:	43220
    Attached Files Attached Files

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Have a look at my CDO EMail Tester app which includes a Help file dealing with the errors you describe and any others that may occur
    http://www.mendipdatasystems.co.uk/e...ter/4594365455

    The error in your first screenshot occurs if you have incorrect settings e.g. server address or port wrong
    It is also shown if Use SSL setting is incorrect

    The second error occurs if the SMTP Authenticate setting is incorrect – try changing this from 0 to 1
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Theof is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2019
    Posts
    8
    Hello isladogs/Colin. Thank you for your comment. I have downloaded and tested your CDO email tester and I still can't get it to work. Something I have observed is that some sites are posting a different SMTP server address/name than the one Microsoft officially states. I added an outlook account to Mozilla Thunderbird and the SMTP address is the same as the one that Microsoft says. Regardless, I have tried both variations and still no success. What am I doing wrong?

    Official SMTP Settings for Hotmail/OutlookClick image for larger version. 

Name:	Official SMTP Settings for Hotmail & Outlook.JPG 
Views:	24 
Size:	55.6 KB 
ID:	43222


    Alternate SMTP SettingsClick image for larger version. 

Name:	Alternate SMTP Server for Hotmail & Outlook.JPG 
Views:	24 
Size:	89.3 KB 
ID:	43223

    Official SMTP Settings per Microsoft can be found here - https://support.microsoft.com/en-us/...4-9c414e2aa040

  4. #4
    Shadow9449 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Feb 2017
    Posts
    38
    From what I've read, CDO does not officially support TLS so you are officially out of luck.

    That said, some people have reported being able to use different workarounds. I know I've encountered this myself but never spent enough time seeing if I could solve it.

    Examples of workarounds:

    https://codekabinett.com/rdumps.php?...access-vba-cdo

    Codekabinett (he has a really interesting YouTube channel that I follow, btw) shows a way that he says works, so maybe try that?

    This one says to try SSL on port 25:

    https://www.tachytelic.net/2018/12/e...ba-office-365/

    Here's some more light reading on the topic:

    https://social.msdn.microsoft.com/Fo...orum=accessdev

    As I said, I've never tried it myself but you might have to try a few workarounds till you solve it.

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Hi Shadow
    CDO can definitely be used with SSL. For example, the screenshot below is from one of my email accounts:

    NOTE that one uses port 465 with SSL.
    Send Mail using method is almost always 2 regardless of network settings
    There is an extra complication if using GMail due to its use of two factor authentication - how to manage this is also explained in the help file accompanying my app

    @Theof
    All I can suggest is you work through one step at a time and compare any error messages with the explanations given in the app help file.
    I've never yet had an email account whose settings, if entered correctly, wouldn't work with CDO
    However if any one setting is wrong, the process will fail with an appropriate error message
    AFAIK the help file covers ALL possible error messages and how to fix them

    One tip is to setup the account using desktop Outlook or a smartphone .... then when its working check the settings for use with CDO.

    Good luck
    Attached Thumbnails Attached Thumbnails Capture.PNG  
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    Shadow9449 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Feb 2017
    Posts
    38
    Quote Originally Posted by isladogs View Post
    Hi Shadow
    CDO can definitely be used with SSL. For example, the screenshot below is from one of my email accounts:

    Absolutely! My post was about TLS, not SSL. TLS is required (officially) for Hotmail.

    There is an extra complication if using GMail due to its use of two factor authentication - how to manage this is also explained in the help file accompanying my app
    Yes, and I hope that Google doesn't screw that up in February when they reportedly will be moving to OAUTH!


    Cheers

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Oops. Apologies. I misread your post as you talked about SSL later on.

    Anyway, it can also be used with TLS. My example app includes this code to manage it:
    Code:
         'code for STARTTLS
        If txtPort = 587 Then
            .Item("http://schemas.microsoft.com/cdo/configuration/sendtls").Value = True
        End If
    Having just read Phillip Stiefel's article at codekabinett.com, I see he uses the same sendtls code line

    BTW - it is NOT necessary to use the ancient CDO reference from 2000 mentioned in that article as CDO support has been built into Access for at least 15 years

    I'll worry about OAUTH as & when I need to do so
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    Theof is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2019
    Posts
    8
    Thanks for your replies @Shadow9449 & @isladogs. I appreciate your help and efforts. Regarding what Shadow said on TLS not being officially supported by the CDO specification, I also saw CodeKabinett's post on the 'workaround' that involves including 'sendtls = true' in the CDO config. In fact, the author of the code that I am using, Daniel Pineault of Carda Consultants Inc., also included it.

    Daniel & several others say that the port number should not be included if one is using SSL and thus, they 'disable' the port argument by turning the line into a comment. Somethings aren't clear to me though.

    1. We know that the Hotmail/Outlook SMTP server uses STARTTLS and from what I've read about STARTTLS, it effectively upgrades an insecure connection to a secure one by changing it to TLS. So if this is the case, should the CDO config be setup as an insecure connection by setting 'usessl' to false and the port number to 25 and then 'sendtls' to True?

    2. I originally wanted to use a Yahoo email address but I observed that their authentication method is OAuth2 and I haven't seen any CDO config anywhere online that makes provision for OAuth/OAuth2. Hence my decision to use Hotmail.

    3. Since the problem here is the authentication required by the Hotmail (and Yahoo) SMTP servers, could I use my custom domain's email system as an SMTP relay? - I have mycompany.com
    and the emails are setup on the web hosting cpanel by saving the appropriate MX records in the domain setup. Could I somehow use this email system to forward/relay messages that are from other domains & providers such as Hotmail & Yahoo to the intended recipient?

    @isladogs/Colin, I will go through the help file later tonight.


    I look forward to your replies. Thanks.

  9. #9
    Shadow9449 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Feb 2017
    Posts
    38
    Quote Originally Posted by isladogs View Post
    Oops. Apologies. I misread your post as you talked about SSL later on.

    Anyway, it can also be used with TLS. My example app includes this code to manage it:
    Code:
         'code for STARTTLS
        If txtPort = 587 Then
            .Item("http://schemas.microsoft.com/cdo/configuration/sendtls").Value = True
        End If
    Having just read Phillip Stiefel's article at codekabinett.com, I see he uses the same sendtls code line
    Well, that's cool that you've confirmed that it works with Hotmail...

  10. #10
    Theof is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2019
    Posts
    8
    I should point out that the Hotmail/Outlook addresses that I want to send from are not signed up for Office 365 (now Microsoft 365). Could this be an issue? I ask because the official SMTP server address is: smtp.office365.com

    Could this be the reason some other sites are using a supposed alternate SMTP address such as: smtp-mail.outlook.com?

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    i can't answer specific questions about individual email addresses in post #10.
    Going back to post #8 and your numbered points:
    1. No. Try port 465 or 587 as appropriate
    2. Not had a reason to test against OAuth so can't say if it works. However my guess is the solution I used for GMail will continue to work
    3. Yes to the first part & quite possibly to the second.

    Remember what I suggested about getting Outlook or an iPhone to configure qn email account then use the settings it comes up with
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #12
    Theof is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2019
    Posts
    8
    Hi Colin & Shadow. I haven't had time to use the PC to try again. However, I did check the SMTP settings of an Outlook address in a third party email client on my phone and the interesting thing is the SMTP address is not the official one. It's the alternate one that I mentioned in a previous comment. The screenshot is attached. The email client is AquaMail for Android.

    Click image for larger version. 

Name:	Screenshot_2020-10-15-23-04-23-090_org.kman.AquaMail.jpg 
Views:	13 
Size:	36.1 KB 
ID:	43230

    Click image for larger version. 

Name:	Screenshot_2020-10-15-23-06-19-340_org.kman.AquaMail.jpg 
Views:	13 
Size:	45.0 KB 
ID:	43231

    So I think I'm going to stick with this alternate server: smtp-mail.outlook.com


    ​I'll keep you apprised. Thanks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Email VBA not working! Run-time error '287'
    By TerraEarth in forum Programming
    Replies: 6
    Last Post: 10-25-2019, 04:09 PM
  2. VBA New Email From Template No Longer Working
    By breakingme10 in forum Programming
    Replies: 0
    Last Post: 02-27-2019, 11:01 AM
  3. Email from Access no longer working
    By Gina Maylone in forum Access
    Replies: 4
    Last Post: 10-12-2016, 06:46 AM
  4. Email Updates Not Working Properly
    By quirkyd in forum Import/Export Data
    Replies: 1
    Last Post: 10-26-2014, 09:24 AM
  5. Auto email not working
    By edzigns in forum Programming
    Replies: 1
    Last Post: 04-29-2011, 12:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums