Videos
Check out our tutorial video series.
How to Test Mail Relay for Vulnerabilities: Learn the difference between SMTP Relay and Server, and use testing tools like TelNet, SMTPCli and MailSlurp.
It might be challenging to test a relay for the first time. You will discover in this article how to approach the process easily. Let's start by explaining the definitions of some terms you might encounter.
First, SMTP relay describes the process of sending emails to a specific SMTP server. A relay exists between the MSA and the MDA if the sender and the recipient are on different domains (served by different SMTP servers).
As a result, if an email is sent from a related domain without using a different server, it does not count as an email relay. When testing an SMTP relay, you must test the actual SMTP server that relays emails because an SMTP relay frequently refers to the SMTP relay server, also referred to as a mail transfer agent (MTA).
An SMTP server that has been incorrectly configured and allows email to be forwarded by unauthorized parties is known as an open relay. Spammers can connect to the server and send emails using it while falsifying the message's sender information.
How do I perform the open relay test, then? You can use the RCPT TO and MAIL FROM commands to send an email to a different domain while telneting to the server. If no authentication request was made and the final response code is 250, your server is an open relay.
The most popular method for determining whether the mail server permits relaying of a specific domain is through Telnet. Telneting to your SMTP server will typically be sufficient to identify common connection problems.
However, you need to use a MIME tool to create authentication strings manually using Telnet. Additionally, because SSL and TLS connections have restrictions, there aren't any built-in SMTP commands or macros, and you should expect frequent server disconnections.
With that in mind, we decided to put Telnet away and introduce other ways to troubleshoot the SMTP relay.
The SMTP-CLI is a good Telnet substitute. SMTP-CLI is an SMTP command line client that supports STARTTLS, SMTP-AUTH, and several other sophisticated features.
The GitHub releases page has links to the most recent version of SMTP-CLI. As an alternative, you can download a widget and install it using the proper command using a download utility:
Users of Ubuntu are to install the following packages:
Test the local host first by connecting to the server and watching the fundamental SMTP back and forth.
You can attempt to send an email through the server that requires authentication to test the relay. This is how the SMTP session will appear:
You can perform this test using the Socket Labs-created SMTP Server Connection Diagnostics Tool. It is more secure than telnet, supports open and SSL connections, and has built-in authentication.
You can test relaying without manually entering each command. The tool has a library of macros that makes the testing process easier.
Here, installing the tool is not necessary. You download and run it.
Step 1: Connect to the server
In the tool's left-hand corner, click Connect after selecting Actions. Enter the server name and port for your SMTP server. Maintain the LocalIp setting as the default, then click Connect.
Step 2: Test relaying
Utilize the integrated command macros to send emails from your SMTP server. The flow is the same as with telnet. The distinction is that you don't have to carry out every task manually.
The Perl tool called Swaks is used to test SMTP configurations on the command line. It's a dinosaur tool; the first release was in 2003.
To install swaks on Ubuntu, run the following commands:
on macOS
Assume you have an SMTP server named smtp.example.com that permits relaying for duly authenticated users. To test this, do the following:
This is how the conversation will look:
You can use online tools to test relays; enter your SMTP server information and press the button. The DNS Exit is one of the tools for testing mail servers for this. MailSlurp is another great relay test tool.
Along with other email-related services, DNS EXIT provides a variety of static/dynamic DNS services. By telneting to your SMTP server and using their Mail Server Testing Tool, you can attempt to deliver the message. If there are any configuration mistakes, the tool will let you know and offer you suggestions on how to fix them.
By learning how to test SMTP relay server connections, you can quickly identify any problems you might be experiencing when connecting to your SMTP server. You might be dealing with issues like the SMTP server's inability to send messages, a communication restriction on the server, a broken server connection, and more.
Check out our tutorial video series.
Email and SMS guides for automation and testing.
View github project code for multiple languages.
Latest posts from the MailSlurp team.
Test, build, and automate messaging with a free MailSlurp account.