Test SMTP connection

Automation Workshop strongly relies on its email sending capacities. Not only it features Send email Action that can send automated email messages according to user specified scenarios, but it also uses email to report successful Task completions and failures. Since Automation Workshop uses specified SMTP server for sending email, it is essential to ensure SMTP connectivity. If SMTP server is not reachable, Automation Workshop will not be able to deliver email messages, which in turn can lead to various problem situations.

This article will show how to troubleshoot SMTP connectivity by using ping and telnet commands as well as Send email Action built-in in Automation Workshop.

Options - Email Server properties

Verify SMTP server settings. First of all, ensure that the email settings are configured correctly. Open Options from Tools menu in Automation Workshop manager and go to the Email Server tab. SMTP server name or IP address as well as connection type and port number must be specified correctly. If unsure, contact system administrator or consult SMTP server help to get the necessary parameters. If SMTP server is provided by Internet Service Provider (ISP), try contacting its support service to inquire for necessary SMTP server parameters.

Step 1: Ping SMTP server to verify server connectivity. As the first SMTP connectivity test, let us try using ping command. We need to open Windows command prompt.

How to open Windows command prompt in Windows XP, Windows Server 2003 and Windows Server 2003 R2? Click on the Run option in Start Menu. Type cmd in the Run window and click OK.

How to open Windows command prompt in Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2? Open the Start Menu and type cmd in Search program and files input. Click on cmd.exe in the list.

C:\>ping mail.example.com

When in Windows command prompt, type ping mail.example.com where "mail.example.com" is the name or IP address of SMTP server you intend to use. Normally, if SMTP server is reachable, it should reply. If SMTP server is not reachable, the ping request will timeout. However, some SMTP servers are configured to explicitly block ping requests. Thus, even if the ping packet timeouts, you should still try to telnet the SMTP server unless absolutely sure that ping command should not be blocked.

C:\>ping mail.example.com

Pinging mail.example.com [192.168.0.33] with 32 bytes of data:
Reply from 192.168.0.33: bytes=32 time=56ms TTL=54
Reply from 192.168.0.33: bytes=32 time=56ms TTL=54
Reply from 192.168.0.33: bytes=32 time=56ms TTL=54
Reply from 192.168.0.33: bytes=32 time=57ms TTL=54

Ping statistics for 192.168.0.33:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
   Minimum = 56ms, Maximum = 57ms, Average = 56ms

C:\>

Most probably though, if ping command timeouts, the server address is not reachable. If SMTP server does not work, although its IP address is reachable by ping command, the SMTP server software might not be running on the specified machine.

C:\>ping mail.example.com

Pinging mail.example.com [192.168.0.33] with 32 bytes of data:
Reply from 192.168.0.33: Destination host unreachable.
Reply from 192.168.0.33: Destination host unreachable.
Request timed out.
Request timed out.

Ping statistics for 192.168.0.33:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\>

Step 2: Telnet SMTP server. Telnet is TCP/IP based protocol that can be used to connect remote computer system through terminal emulation program. We will use it to verify SMTP server connectivity.

How to start telnet program in Windows XP, Windows Server 2003 and Windows Server 2003 R2? Click on the Run option in Start Menu. Type telnet in the Run window and click OK.

How to start telnet program in Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2? Open the Start Menu and type telnet in Search program and files input. Click on telnet.exe if it is present in the list. If telnet.exe is not in the list, probably it is not be installed.

Installing telnet client on Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2. Click Start button, select Control Panel, Programs, and click on Turn Windows Features on or off. In the available program list, scroll down and select Telnet Client. Click OK to start the installation. Alternatively, run the following command string from command prompt or Run window:

C:\>start /w pkgmgr /iu:"TelnetClient"

When telnet terminal is open, we can now continue with SMTP connectivity testing. To connect to the SMTP server, type: o smtp.example.com 25 in telnet command prompt (where smtp.example.com should be replaced by actual SMTP server and 25 by the actual SMTP server port).

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet>
o smtp.example.com 25

Alternatively, you can enter telnet command followed by SMTP server name or IP address directly into Run window or Search program and files input (both accessible from Start Menu).

C:\>telnet smtp.example.com 25

If connection is successful, SMTP server should return code 220 with server address, connection type, greeting, mail server software version and other information. Sometimes, though, the server is configured to return only reply code (without other text). Let us try sending SMTP server some command to see if it is responding.
Enter the following: helo testing.

220 smtp.example.org ESMTP Server is glad to see you!
helo testing

Normally, SMTP server should return code 250 followed by additional information. If codes 220 and 250 were returned when, respectively, connecting SMTP server and sending helo command, SMTP server is most likely working properly.

220 smtp.example.org ESMTP Server is glad to see you!
helo testing
250 smtp.example.org

If using telnet to establish SMTP connection has failed, try checking local firewall and antivirus software settings to see if telnet has necessary rights to connect to the SMTP server. Also ensure that SMTP is accepting connections from the IP address of this particular machine.

If telnet connection is working properly, yet Automation Workshop can not connect to SMTP server, try checking antivirus and firewall settings either on local machine or remote hardware to see if Automation Workshop has necessary rights to connect to the SMTP server.

Step 3: Testing SMTP connectivity with Send Email Action. Even if ping and telnet commands return fully successful results when testing SMTP server connectivity, some other problems might persist. We will use Send email Action of Automation Workshop to retrieve the most detailed data on the connection between Automation Workshop and SMTP server.

First, let us create a Task that will test SMTP connection whenever it is executed. Open Automation Workshop and click New Task… in File menu. This will open the Task Wizard. After reading the Welcome screen, click Next. Click Next once more to skip the Trigger screen (unless you would like to setup periodic SMTP testing by adding Task Scheduler trigger). In Actions tab, push the Add button (this will open Add Action window) and select Send Email from Email category, and click OK - this will open Send email Action settings.

Now, let us configure Send Email Action for SMTP testing. Fill in From, To, Subject and Email text fields. Then, open Email Server tab and choose either default SMTP server (set in of Automation Workshop options) or custom SMTP server. In the latter case we will have to specify SMTP server address, port, connection security protocol and authentication type and credentials.

After configuring SMTP server settings, go to Advanced tab. We have to enable client / SMTP server communication logging in order to save data session into text file. Enable the checkbox and choose the file in which you would like to save SMTP server communication with Automation Workshop.

Enable client / SMTP server communication logging - log file.txt

Since every new log overwrites the previous one, we can add date and time variable to file name specification in order to preserve all log files, each with recognizable name. Click Variable Wizard button and choose Sortable file (dashed) from Presets in Date / Time category. This option returns current date and time in easy to read format that can be used in file names (i.e., without characters not allowed in file names like slashes or colons).

Enable client / SMTP server communication logging - log file (date).txt

In either case choose Log full client / server communication details as Log level setting to save as much data as possible for troubleshooting purposes.

Finally, check Headers and Options tabs for additional options you would like to set and click OK to save the Send Email settings and return to Task Wizard. Click Next to configure email reports in Reports tab. Then in Task tab give Task a name and, optionally, description and finish creation of Task.

The Task is now saved in the Task folder where we created it. If the Task Scheduler trigger was not added when the Task was created, it can only be executed manually. Select the Task and choose Run Task option from File menu. Alternatively, Run Task can be accessed from context menu, Task toolbar and keyboard shortcut Ctrl+F5.

Every time you run the Task, it will perform the Send email Action which will send email from specified email address to specified recipient and, additionally, save communication session with SMTP server into the text file with unique name containing the date and time the Send email Action was performed. Now you can either analyze the logs to see if some errors occur or send these text files to support to illustrate the issue at hand.

Example of successful email session:

Server: 220 smtp.example.org ESMTP Server is glad to see you!
Client: HELO user
Server: 250 smtp.example.org
Client: MAIL FROM:<sender@example.com>
Server: 250 2.1.0 Ok
Client: RCPT TO:<recipient@example.com>
Server: 250 2.1.5 Ok
Client: DATA
Server: 354 End data with <CR><LF>.<CR><LF>
Client: From: sender@example.com
To: recipient@example.com
Subject: Testing SMTP connectivity!
X-Mailer: Febooti Automation Workshop (Unregistered)
Content-Type: text/plain;
              charset=UTF-8
Date: Wed, 3 Nov 2010 17:13:54 +0200
X-Priority: 3 (normal)

SMTP connectivity test
(with logging session details to text file).

---
email sent by unregistered version
of Febooti Automation Workshop v2.0.2
visit http://www.febooti.com to get full version


Client:
.
Server: 250 2.00 Ok: queued as 7C00F9D715
Client: QUIT
Server: 221 2.00 Bye

The list of most common SMTP reply codes:

SMTP reply codeDescription
214Help message.
220Service ready.
221Service closing transmission channel.
250Requested mail action okay; completed.
354Start mail input; End data with <CR><LF>.<CR><LF>
421Service not available; closing transmission channel.
450Requested mail action not taken; mailbox unavailable.
500Syntax error; command unrecognized.
501Syntax error in parameters or arguments.
502Command not implemented.
503Bad sequence of commands.
504Command parameter not implemented.
521Domain does not accept mail.
530Access denied.
535SMTP authentication unsuccessful.
550Unable to relay.
552Requested mail action aborted; exceeded storage allocation.
553Requested action not taken; mailbox name not allowed.
554Relay access denied.

Most common error is relaying denied (with code 550 or 554) which usually means that user authentication (username / password) is necessary in order to send email through the particular SMTP server. Some examples of relaying denied error texts (depends on SMTP server software and version):

  • Server Response: 550 Relaying is prohibited.
  • Server Response: 550 5.7.1 Unable to relay.
  • Server Response: 550 Relaying denied.
  • Server Response: 554 Relay access denied.

If all tests are successful, the email should be delivered to recipient's address. If the test email is not delivered, there might be some problems with recipient's mailbox (e.g. mailbox does not exist, is full or some other problem). Check the mailbox specified in the From address to see if it contains email delivery problem notification from mail system. If accessible, you can also consult SMTP server log files.

Conclusion. We have tested SMTP server connectivity by using ping and telnet commands as well as the Send email Action that is built-in in Automation Workshop. While the former two allowed us to verify whether the machine at the specified address is online and whether it is correctly running SMTP server software on the specified port, respectively, the use of Send email Action has provided us with full communication data between Automation Workshop and SMTP server. The communication session log is saved into uniquely named text file each time the SMTP testing Task is executed.

Free trial 15 day trial · Details…
Buy now 30 day MBG · Details…

If you have any questions, please do not hesitate to contact our support team.

© 2001-2014 Febooti Software. Last updated: April 18, 2014