:::: MENU ::::

Testing SMTP server using telnet (whether with authentication or not)

  • Dec 18 / 2014
  • 0

Testing SMTP server using telnet (whether with authentication or not)

You can need to perform testing with your SMTP server and see if you are able to send mail with it.
You have your domain name, and you want to check if mail server is answering properly?

1. Check the mail server with DNS entries

We first need to find the right DNS entry for MX record and know what is the mail server.

2. Open connection to mail server (default ports 25,587)

We will now open a telnet connection on the mail server we just found. Port to use can be different depending on the configuration of the server mail.

The answer can change depending on the mail engine used, this is just an example.

3. Send an email with or without authentication

In case of there is no authentication needs (an open smtp server), just perform:

If the server requests an SSL/TLS authentication before being able to send mail, you will probably need to use openssl library as telnet does not support TLS by default (you will get an error on STARTTLS command).
You will also need to prepare the credentials by encoding them in base 64:

Once you got this, you can open connection and request mail sending as following:

Notice that if the mail server doesn’t allow SMTP relay, you won’t be able to send a mail to another domain that the ones that this server is allowing. In that case, you will get an error as:

That means you will only be able to send mail to an “@mydomain.com” mail address and not to any other.

Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone

Comments are closed.

Question ? Contact