Test SMTP Server Manually with Telnet / Open SSL

Classic Plain Text No Authentication

Blatantly ripped and modified and trimmed from http://www.petri.co.il/smtp_pop3_and_telnet.htm.

Telnet to the IP address of the remote mail server, and use port 25 for SMTP.

220 srv.example.net ... ready ...

helo srv1.dpetri.net
250 srv.example.net Hello [192.168.0.100]
mail from: <admin@example.com>
250 2.1.0 admin@example.com....Sender OK
rcpt to: <someguy@example.net>
250 2.1.5 someguy@example.net
data
354 Start mail input; end with .
subject: this is a test
Hi. A test via Telnet.
.
250 2.6.0 ... Queued mail for delivery
quit

Update: I have had one mail server that refused delivery if the email addresses did not have angle brackets around them, e.g. .  (LOL, eaten by the text editor again) - < someguy@example.net >

 

Testing Authenticated SMTP:

https://www.ndchost.com/wiki/mail/test-smtp-auth-telnet

key command in SMTP is "SMTP AUTH" -- but you need the base64 username and password. See link. Use PERL.

Somewhere along the way "POP before SMTP" became obsolete!

 

perl -MMIME::Base64 -e 'print encode_base64("username");'
perl -MMIME::Base64 -e 'print encode_base64("password");'
If you have any special characters such as @ or ' or ! you must put \ in front of it to escape the character.

AUTH LOGIN

(server should send 334.... send username)

(sever should send 334 ... send password)

 

 

 

Encrypted and Authenticated SMTP (STARTTLS)

openssl s_client -connect mail.example.com:25 -starttls smtp

Based on: https://scottlinux.com/2014/06/05/check-for-smtp-tls-from-command-line-with-openssl/

Related Scribbles:
  • Email Notes
  • SMTP Return Path
  • Telnet for UDP - netcat
  • Test HTTP with Telnet
  • Test POP3 with Telnet Example
  • Test Services (POP3, HTTP, IMAP) with OpenSSL


  • ID: 522
    Author:
    leonard
    Date Updated:
    2018-08-23 15:24:20
    Date Created:
    2004-08-04 17:34:32

    Edit

    Comments?
     >> Leonard Chan's Homepage  >> Scribble Web  >> Test SMTP Server Manually with Telnet / Open SSL
    leonard.lotus-land.ca is hosted by Perceptus Solutions Inc.