User Tools

Site Tools


exim4:test_exim4_with_telnet

Exim4 - Test Exim4 with Telnet

Telnet To Exim Mail Server On Port 25:

telnet mail.somedomain.com 25

Once connected to the mail server on port 25 using telnet you will need to introduce yourself to the mail server using a SMTP HELO or possibly a EHLO which are both very similar.

Introduce Yourself To The Mail Server Using EHLO:

EHLO

After the introduction attempt to authenticate via SMTP Authentication which may or may not be required. Many mail servers now require that you login via SMTP Authentication if you have not sent credentials over POP in the past 30 minutes or 1 hours. To login via SMTP Authentication you will first be required to convert the username and password to base64-encoding which can be done using the commands below. If you have any special characters they will need a backslash in front of them such as the “@” symbol in the example below. Make sure that you type the below base64-encoding perl conversion , in a second terminal window outside of the telnet session.

Convert Username & Password To Base64-Encoding:

perl -MMIME::Base64 -e 'print encode_base64("user\@mytestdomain.com")'
perl -MMIME::Base64 -e 'print encode_base64("password321")'

Authenticate To The Mail Server With SMTP Authentication:

AUTH LOGIN YWxleEBteWdlbml1c3R2LmNvbQ==
aGVsbG8wOTg=

After authentication you will get a confirmation message back from the mail server that will state something similar to “Authentication Succeeded”. After you are authenticated you can begin the send email dialogue with the mail server as shown below.

Send Email Sender & Email Recepient:

MAIL FROM:<user@testdomain.com>
RCPT TO:<someuser@anotherdomain.com>

Send Email Contents Including Subject & Body:

DATA
 
Subject: Test Exim Mail Server
Hello Exim, Please enjoy this test.
.

Once you click enter after the “.” the email will send to the email address specified after “RCPT TO”. The mail server may close the connection immediately or you may be required to type “quit” followed by enter. Now that each command has been explained in detail above the below is a complete output from a Linux terminal window that will also display the mail servers responses so you can follow along.

Linux Terminal Output For Sending Email With SMTP Authentication Over Telnet:

telnet mail.example.com 25
Trying 192.168.1.2...
Connected to mail.example.com (192.168.1.2).
Escape character is '^]'.
EHLO220-fg.yetanotherdomain.com ESMTP Exim 4.69 #1 Thu, 29 Jul 2010 05:13:48 -0700
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
 
250-fg.yetanotherdomain.com Hello sub.anothertestdomain.com [192.168.111.13]
250-SIZE 52428800
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
AUTH LOGIN Y87f4rJeWdlbml1c123LmUvbQ==
334 JGre2dvcnQ5
aGVsbG8wOTg=
235 Authentication succeeded
MAIL FROM:<johnx@example.com>
250 OK
RCPT TO:<john@example.com>
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Subject: This is a test over telnet
Hello. We are testing sending email via telnet on a mail server that requires SMTP Authtentication.
.
250 OK id=1OeS1P-0005Hp-N2
quit
221 yetanotherdomain.com closing connection
Connection closed by foreign host.

You should now be able to send and receive email without an Email client. This will assist you in pinpointing problems faster by not only having more information immediately but also by not filtering out the server error codes.

exim4/test_exim4_with_telnet.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki