How to send an email on port 25 from VM

Kasey Herzberg 0 Reputation points
2025-03-11T19:44:57.43+00:00

I have a VBscript that watches a folder and alerts me when the folder hasn't been updated in a certain amount of time. If it needs to, it sends an email message via SMTP. These emails will not send from my Windows Server 2012 VM via port 25 or 587. Error: The transport failed to connect to the server. Code: 80040212I am able to send emails with this exact code on my Windows Server 2019 VM. Any help would be greatly appreciated.

Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,629 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mars Shan-MSFT 545 Reputation points Microsoft External Staff
    2025-03-12T01:57:24.8133333+00:00

    Hello,

    Below are several troubleshooting steps and potential solutions to help your VBScript send an email via SMTP on port 25 from your Windows Server 2012 VM.

    1. Check network connectivity from the Windows Server 2012 VM:

     • From the VM, try using Telnet (if installed) to connect to your SMTP server on port 25. For example:

      telnet your.smtp.server.com 25

     • If the connection fails (or times out), you likely have a firewall or network routing issue blocking outbound traffic on port 25.

    1. Verify firewall settings:

     • Ensure that the Windows Firewall (or any network firewall between the VM and the SMTP server) isn’t blocking outbound connections on port 25, 587, or whichever port your SMTP server uses.

     • Compare your Windows Server 2012 settings to your Windows Server 2019 VM since you mentioned that the same script works there. A change in firewall policy may be the culprit.

    1. Confirm SMTP server configuration:

     • Double-check the SMTP server address and port number in your VBScript. Even a slight misconfiguration can cause connection failures.

     • If your SMTP server requires authentication or TLS/SSL, confirm that your code is set up accordingly. Older servers or configurations might handle TLS differently than Windows Server 2019.

    1. Update security protocols if necessary:

     • Many SMTP servers now require TLS 1.2 or higher for security reasons. Windows Server 2019 has robust support for TLS 1.2 by default, while Windows Server 2012 sometimes requires extra configuration or updates to support TLS 1.2.

     • Check if installing any Windows updates or registry settings changes on the Server 2012 VM might be needed to enable proper TLS support.

    1. Review your VBScript configuration:

     • If you’re using the CDO.Message object in your script, double-check that all configuration fields (like "http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtpserverport", etc.) are correct.

     • In some cases, explicitly setting the connection timeout or using a different authentication model (if needed) may help resolve connection issues.

    1. Consider testing an alternative port:

     • Although you mentioned both port 25 and 587 failed, verify with your SMTP provider if they have any restrictions or recommended ports for non-standard clients (especially from VMs). Sometimes ISPs or cloud providers restrict outbound port 25 to reduce spam risk.

    By following these steps you can narrow down whether the error is due to a network/firewall restriction, a configuration mismatch, or possibly an outdated security protocol on the Windows Server 2012 VM. Once you identify where the connection is being blocked, you can adjust your firewall policies, update your server configuration, or modify your script settings accordingly.


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.