Consulting

Results 1 to 11 of 11

Thread: Outlook CDO from home

  1. #1
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    408
    Location

    Outlook CDO from home

    I have been attempting to use CDO to send email. I can get this to work with GMail (had to create an app password in Google account and activate 2-factor authentication because it is a personal account).

    None of the example code I've found will work for Outlook and my live.com email. I don't subscribe to Office 365 and not a business environment, just me at home. Seems this worked years ago with "smtp-mail.outlook.com" as the smtpserver but maybe that was at work before I retired. Is there any way to use CDO with outlook from home network?
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,337
    Location
    Gemini has the following:

    Collaboration Data Objects (CDO) is a Microsoft library that allows you to work with email and other messaging data. While it can be used with Outlook, there are some limitations and considerations when using it from a home network.




    Here's a breakdown of the key aspects:
    1. CDO and Outlook Versions:

    • Compatibility: CDO 1.2.1 is not supported with Outlook 2010 and later versions. This is a crucial factor to consider. If you have a newer version of Outlook, CDO might not function as expected.



    • Alternatives: If you're using a newer Outlook version, you might need to explore alternative methods for working with email programmatically, such as using the Outlook Object Model or Microsoft Graph API.

    2. SMTP Client Submission Requirements:

    • Authentication: You'll need to configure a username and password for your email account to send emails.
    • Mailbox: You must have a valid and licensed Office 365 mailbox to send emails from.
    • Transport Layer Security (TLS): Your system needs to support TLS version 1.0 or above for secure communication.
    • Port: Port 587 (recommended) or port 25 needs to be open and not blocked by your network firewall or Internet Service Provider (ISP).

    3. Home Network Considerations:

    • Firewall: Ensure that your home network's firewall is not blocking the necessary ports (587 or 25) for SMTP communication.
    • ISP Restrictions: Some ISPs might block certain ports, especially port 25, to prevent spam. You might need to contact your ISP to check if there are any restrictions.



    • Dynamic IP Address: If you have a dynamic IP address, it might change periodically, which could affect the configuration of your CDO application.

    4. Configuration:

    • SMTP Server Settings: You'll need to obtain the correct SMTP server settings for your email account, including the server address, port number, and encryption method.
    • Authentication Details: Provide the correct username and password for your email account.

    5. Troubleshooting:

    • Error Messages: Pay close attention to any error messages you encounter, as they can provide clues about the issue.
    • Testing: Test your CDO application thoroughly to ensure that it's sending emails correctly.
    • Documentation: Refer to the official Microsoft documentation and online resources for troubleshooting tips and solutions.

    Important Notes:

    • Security: Be cautious when handling email credentials and ensure that your code is secure to prevent unauthorized access.
    • Alternatives: Consider exploring alternative methods for working with email programmatically, as CDO might have limitations with newer Outlook versions and security considerations.

    Recommendations:

    • Check Outlook Version: Verify the version of Outlook you're using to ensure compatibility with CDO.
    • Review SMTP Requirements: Make sure you meet all the SMTP client submission requirements.
    • Configure Firewall and ISP: Check your firewall settings and contact your ISP to ensure that the necessary ports are open.
    • Explore Alternatives: If CDO is not suitable for your needs, consider using the Outlook Object Model or Microsoft Graph API as alternatives.

    Remember to consult the official Microsoft documentation and online resources for detailed instructions and troubleshooting assistance.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    408
    Location
    I have Office 2010 and 2021. The Microsoft CDO for Windows 2000 Library is still there.
    I do not have Office365.
    CDO with GMail server works.

    So I guess I will consider Outlook a deadend and abandon.
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    VBAX Contributor
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    118
    Location
    Quote Originally Posted by June7 View Post
    I have Office 2010 and 2021. The Microsoft CDO for Windows 2000 Library is still there.
    I do not have Office365.
    CDO with GMail server works.

    So I guess I will consider Outlook a deadend and abandon.
    You *might* have migrated to Outlook New which does not support COM?

    There is a registry entry you can add to stop New taking over, after why would you, if you have code like I have to send emails from Access for example.

    As for CDO Colin has a test app you can use to test your connection. However as you must be aware CDO is just for sending?
    https://isladogs.co.uk/email-tester/index.html

  5. #5
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    408
    Location
    No, I use old Outlook.

    I already tried Colin's app.

    Yes, for sending.

    Not something I really need in my life. Just annoyed that I can get GMail to work but not Outlook. I am NOT subscribing to Office365 - never, never, never.
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    VBAX Contributor
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    118
    Location
    June7,

    From this link https://www.google.com/search?q=live...hrome&ie=UTF-8,
    I got this
    https://answers.microsoft.com/en-us/...0-ebff46388647

    and their issue was the port number?

  7. #7
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    408
    Location
    Yet some sources say port 587. Already tried port 25. Same error message: The "SendUsing" configuration value is invalid.
    Every code example I find shows 2 as the parameter to use:
    MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    VBAX Contributor
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    118
    Location
    Well for SSL/TLS I would expect 587 or 465?

  9. #9
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    408
    Location
    Port number is determined by:

    MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 ' also tried 25
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    VBAX Contributor
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    118
    Location
    I have an outlook.com address.
    If you want to send me a DB with working code, I will try at my end, if that helps at all?

  11. #11
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    408
    Location
    You mean code that works for GMail? Use Colins app from the link in post 4.

    When I try it for Outlook, I get "The transport failed to connect to the server."

    If I change the sendusing method to 1 - local, I get "The pickup directory path is required and was not specified." I don't know what that is.

    With simplified code in my db I get "The "SendUsing" configuration value is invalid"
    Last edited by June7; 02-05-2025 at 11:34 AM.
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •