In some cases, in order to test or diagnose e-mail service, an administrator has to check the sending of emails through their Exchange servers (and other email servers) from certain hosts.If a server doesn’t require an authentication (open-relay server), you can send an e-mail from telnet command prompt. However, in most cases, the mailbox servers require the authentication to send an e-mail. In this example, we’ll show how to perform AUTH LOGIN authentication on the SMTP server and send an e-mail using telnet console.
In Exchange terms, AUTH LOGIN is the basic authentication, when user name and password are transmitted over the network encoded using base64 algorithm. The administrators do not usually disable Basic Authentication on the most of internal Exchange servers. You can see if it is supported in the settings of the Receive connector.
To authenticate on the mail server using AUTH LOGIN, you need to convert the user name and password from which the message will be sent to the Base64 format. You can do it using scripts or online services. I used this website: https://www.base64encode.org/.
The user name firstname.lastname@example.org looked like dGVzdF91c2VyQHdvc2h1Yi5jb20g in Base64
The password $up3RsTr)ng turned into JHVwM1JzVHIpbmc= in Base64
Connect to Port 25 (SMTP) of your e-mail server in the command prompt using Telnet (I’ll highlight the commands to be entered in blue)
telnet mail.woshub.com 25
If it is Exchange, it will return something like:
220 mail.woshub.com Microsoft ESMTP MAIL Service ready at Thu, 11 Nov 2017 10:22:31 +0300
Let’s introduce ourselves:
The server will return the list of supported authentication types and options. As you can see, there is AUTH LOGIN in the list.
250-mail.woshub.com Hello [192.168.1.115]
Ask the SMTP server to authenticate us using the current account:
The server will respond:
Now copy and paste the user name in Base64 format we encrypted earlier:
The server will respond:
Then copy and paste the password in Base64 format:
If the user name and password are correct, the server will return:
235 2.7.0 Authentication successful
535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6
It’s time to fill in the standard e-mail fields:
mail from: email@example.com
250 2.1.0 Sender OK
rcpt to: firstname.lastname@example.org
250 2.1.5 Recipient OK
354 Start mail input; end with .
from: TestUser <email@example.com><
to: TheMainAdmin < firstname.lastname@example.org >
Subject: Test BASE SMTP Authenticated via Telnet
This is test
250 2.6.0 <email@example.com> [InternalId=6334284] Queued mail for delivery
221 2.0.0 Closing connection.
Connection closed by foreign host.
This is all, and the e-mail will be successfully delivered to the recipient mailbox.