logo
search
VBA & Macro Problems

How to Fix Hotmail SMTP Email Sending Errors in Excel VBA

Kushani NimanthikaKushani Nimanthika Sep 27, 2026 869 views

Question details

The user needs to resolve an issue where legacy Excel VBA code fails to send emails through Hotmail or Outlook.com SMTP servers.

How to Fix Hotmail SMTP Email Sending Errors in Excel VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
Running an Excel VBA macro designed to send automated emails using a Hotmail or Outlook.com account.
Observed behavior
The VBA SMTP code stops working and fails to send emails, even with an app password and two-factor authentication enabled, due to the deprecation of basic authentication.
Before you start

Verify that your Microsoft account is active by logging into Outlook.com on a web browser, and ensure your local network or firewall allows outgoing traffic on SMTP port 587.

Solution 1Recommended

Update VBA CDO Settings and Use an App Password

Configure your VBA script to use the latest supported Outlook.com SMTP server details and authenticate securely with an App Password.

Microsoft has largely deprecated legacy basic authentication. To continue using VBA CDO (Collaboration Data Objects) for sending emails, you must ensure your script connects to the modern SMTP endpoints and bypasses standard password entry by using an App Password.

1
Generate an App Password

Log into your Microsoft account's Security dashboard. Ensure Two-Step Verification is enabled, then navigate to 'App passwords' and generate a new unique password. Replace your standard account password with this new app password in your VBA script.

2
Update SMTP Server Details

In your VBA CDO configuration code, locate the server setting and change the 'smtpserver' property value to 'smtp-mail.outlook.com'.

3
Configure Port and Encryption

Set the 'smtpserverport' property to 587. Ensure that SSL/TLS is enabled by setting the 'smtpusessl' or 'sendtls' property to True.

Update VBA CDO Settings and Use an App Password
CDO Configuration Schema: When configuring these properties in VBA, ensure you are appending them to the correct schema namespace: 'http://schemas.microsoft.com/cdo/configuration/'.
Free Microsoft Office alternative

Automate Your Spreadsheets with WPS Office

While modern authentication policies complicate legacy Excel VBA email sending, WPS Office offers a robust, lightweight, and highly compatible alternative for your spreadsheet automation and daily document needs. Enjoy seamless format compatibility without the heavy subscription fees.

  1. 1. Download and Install: Visit the official WPS Office website to download and install the free, lightweight suite on your Windows, Mac, or Linux machine.
  2. 2. Open Your Spreadsheets: Launch WPS Spreadsheets and open your existing .xlsx or .xlsm files directly. WPS handles Microsoft formats seamlessly.
  3. 3. Manage Data Easily: Take advantage of familiar formulas, charting tools, and data processing capabilities to manage your workflows effortlessly.
Highly compatible with Microsoft Excel (.xlsx, .xls) and macro-enabled (.xlsm) formats.Supports powerful formulas and spreadsheet automation tools.Lightweight installation with a familiar, user-friendly tabbed interface.Completely free to use for daily document processing and data analysis.
QA img-9

Frequently Asked Questions

Why did my Excel VBA email script suddenly stop working with Hotmail?

Microsoft has aggressively phased out basic authentication for email protocols in favor of Modern Authentication (OAuth2) to improve security. Older VBA scripts using CDO rely on basic authentication, which is now blocked even if you provide the correct username and password.

Can I still use CDO.Message in VBA to send emails via Outlook.com?

Yes, but it requires having Two-Factor Authentication (2FA) enabled on your Microsoft account and generating a unique 'App Password' to use in your VBA script instead of your standard Microsoft account password.

Where can I get specialized programming help if my VBA email code still fails?

Programming questions related to VBA are best suited for developer forums like Stack Overflow. When posting, be sure to use the 'vba' tag, include your sanitized code, and provide detailed error messages so the developer community can assist you effectively.