To test your smtp server, to see if it is an open relay or to
test if your authentication works on it. Use telnet to connect
to the server, this allows you to very quickly test different connection
scenarios to the server. this method is very useful if you
want to test how your smtp server behaves from different remote locations,
and all you have is an ssh account into the locations you want to test from.
You can simply ssh into the remote location you want to test from and then
follow these steps
In this example I wanted to test if basic outgoing smtp authentication was working on my server (everything in
Bold is what you type everything not in bold is the servers response)
telnet smtp.mailserver.com 25
Trying 195.158.102.65...
Connected to mail.clivesblog.com.
Escape character is '^]'.
220 smtp.mailserver.com.com ESMTP ready
ehlo
250-smtp.mailserver.com ESMTP hello
250-PIPELINING
250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5 GSSAPI
250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 GSSAPI
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-SIZE 10485760
250-STARTTLS
250-HELP
250 OK
auth login
334 VXNlcm5hbWU6
Y2xpdmUuZ2VyYWRhQHJzMi5jb20=
334 UGFzc3dvcmQ6
cnMy
235 Authentication successful
mail from:clive.gerada@clivesblog.com
250 Sender accepted
rcpt to:
anybody@anyaddress.com
250 Recipient accepted
data
354 Ready to receive data; remember
.
subject: any subject
double space (ie hit the space bar twice)
then enter any text for the body of the email
.
250 Mail queued for delivery
quit
221-smtp.mailserver.com ESMTP is closing connection
221 Good bye
the Y2xpdmUuZ2VyYWRhQHJzMi5jb20=
and cnMy
is my username and password encoded in Basd64 cypher
you have to encode it in base64 for the server to understand it.
you can use the following online tool to encode and decode to and from base64
perl -MMIME::Base64 -e 'print encode_base64("username");'
perl -MMIME::Base64 -e 'print encode_base64("password");'
will encode base64 for you or alternatively you can use an online encoder like
http://ostermiller.org/calc/encode.html