Email - How to verify your SMTP connection and parameters (TSL/SSL) with TELNET ?

About

An article showing how you can verify the smtp parameters with telnet.

Article related

Prerequisites

You must be in the possession of your smtp parameters. The best way is to use the smtp of your ISP because you will then have access to a ssl connection, and with it, the possibility to send an email everywhere you are.

We are going to try to connect to the Smtp server with this credential :

  • smtp server : smtp.xs4all.nl
  • port : unsecure 25 or secure TLS : 587
  • Login : login
  • Password : password

If you search a free stmp service, the site Gmx.com is reported as offered a free smtp server which work without STARTTLS or the need to upgrade to a professionnal account as for instance Google and Yahoo ask for. (To know more about the test on Yahoo and Google, see the Google and Yahoo section)

  • smtp server : mail.gmx.com
  • port : 25

Before we continue with the process, if we use a secure SMTP, we need to encode our credential in a base64 encoding. You can perform a search on Google to find an encoder or you can go on this one :

Enter the login and click on the encode button, copy the result and do the same for the password. We retrieve then this values :

  • Login in base64 is bG9naW4=
  • Password in base64 is cGFzc3dvcmQ=

Port Used by Smtp Service

The following ports can be used in a smtp service :

Service Port Service
smtps 465/tcp #smtp protocol over TLS (was ssmtp)
submission 587/tcp Submission for Simple Mail Transfer

Telnet

Below, you can find all the command that you must tape in the telnet windows.

If you don't use a SSL smtp, you can ommit the lines :

AUTH LOGIN
bG9naW4=                       <-- login
cGFzc3dvcmQ=                   <-- password
ehlo nico
AUTH LOGIN
bG9naW4=                       <-- login
cGFzc3dvcmQ=                   <-- password
MAIL FROM: [email protected]
RCPT TO: [email protected]
DATA
This a big big test
.
QUIT

The Smtp Server will always respond with a message.

If you do a mistake when you tape a command and then you go back to correct it, you will have in anyway an error message.

QUIT
500 5.5.1 Command unrecognized: "QUIT"

This message is not true, the command QUIT exist but if you have done a mistake as for instance if you have written QUIY, you correct it and you valid, you will have this error.

Open a command dos and launch telnet for the smtp server smtp.xs4all.nl on the port 587

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Nicolas>telnet smtp.xs4all.nl 587

The server smtp must answer :

220 smtp-vbr15.xs4all.nl ESMTP Sendmail 8.13.8/8.13.8; Sun, 26 Apr 2009 14:17:28 +0200 (CEST)

And you can begin to talk :

ehlo nico
250-smtp-vbr15.xs4all.nl Hello 5353DF77.cable.casema.nl [83.83.223.119], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 31457280
250-DSN
250-AUTH LOGIN PLAIN
250-STARTTLS
250-DELIVERBY
250 HELP
AUTH LOGIN
334 VXNlcm5hbWU6
bG9naW4=
334 UGFzc3dvcmQ6
cGFzc3dvcmQ=
235 2.0.0 OK Authenticated
MAIL FROM: [email protected]
250 2.1.0 [email protected] Sender ok
RCPT TO: [email protected]
250 2.1.5 [email protected] Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
This a big big test
.
250 2.0.0 smtp-vbr15.xs4all.nl accepted message n3QCHS17026035
QUIT
221 2.0.0 smtp-vbr15.xs4all.nl closing connection

Connection to host lost.

The result

_

Support

Smtp Error

You have an error code, see this article to find the meaning :

With Google / STARTTLS

Basic telnet does not support SSL or TLS. You have to use openssl or stunnel to verify your smtp parameters.

telnet smtp.gmail.com 587
220 mx.google.com ESMTP 10sm8014744eyd.42
ehlo hostname.com
250-mx.google.com at your service, [83.83.223.119]
250-SIZE 35651584
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 PIPELINING
AUTH LOGIN
530 5.7.0 Must issue a STARTTLS command first. 10sm8014744eyd.42
STARTTLS
220 2.0.0 Ready to start TLS
EHLO NICO


Connection to host lost.

With Yahoo

telnet plus.smtp.mail.yahoo.com 587
220 smtp107.prem.mail.ac4.yahoo.com ESMTP
ehlo nico
250-smtp107.prem.mail.ac4.yahoo.com
250-AUTH LOGIN PLAIN XYMCOOKIE
250-PIPELINING
250 8BITMIME
AUTH LOGIN
334 VXNlcm5hbWU6
Z2VyYXJkbmljb0Byb2NrZXRtYWlsLmNvbQ==
334 UGFzc3dvcmQ6
ZmFrZXBhc3N3b3Jk
530 Access denied : Free users are not supported on this server.

Reference : POP Yahoo! Mail Plus with Microsoft Outlook Express

With Gmx

See Gmx Help: POP3 & IMAP Server for more info.


Powered by ComboStrap