Send an email via telnet.

To send an email via telnet just type:

root:~# telnet 172.16.12.25 25
220 hostname.com Internet Agent 0.0.3
HELO domain.com
250 hostname.com Ok
MAIL FROM: you@hostname.com
250 Ok
RCPT TO: them@hostname_away.com
250 Ok
DATA
354 Enter mail, end with "." on a line by itself
ie, type your message or whatever
.

250 Ok
quit
221 hostname.com Closing transmission channel
Connection to host lost.

By the way, you will not see any AUTH listed when connecting and doing an ehlo. In addition any attempt to auth will be met with the error:

035.5.1 Error: authentication not enabled

It will not display options for smtp authentication unless a TLS security is used to connect.

Try connecting with:

openssl s_client -connect localhost:25 -starttls smtp

Now you will see the 250-AUTH PLAIN LOGIN on ehlo and you will be able to auth.

When posting logs of the SASL negotiations to public lists, please keep in mind that username/password information is trivial to recover from the base64-encoded form.

You can use one of the following commands to generate base64 encoded authentication information:

Using a recent version of the bash shell:

echo -ne '00username00password' | openssl base64

Some other shells support similar syntax.

Using the printf command:

printf '%s%s' 'username' 'password' | openssl base64
printf '%s%s' 'username' 'password' | mmencode

The mmencode command is part of the metamail software.

root:~# openssl s_client -connect 4network.eu:25 -starttls smtp

and the output:

Compression: 1 (zlib compression)
Start Time: 1373377800
Timeout : 300 (sec)
Verify return code: 18 (self signed certificate)
---
250 DSN

and then type:

ehlo domain.org
250-hades
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

auth plain AGpvbGFudGEAam9sYW50YQ==
235 2.7.0 Authentication successful

SMTP Status Codes
You may notice along the way that after typing commands you see responses from the server starting with “250″. 250 is a good thing, and there are a lot of other SMTP status codes you’ll encounter the more you use this technique.

Reply codes in numerical
Code Meaning

200 (nonstandard success response, see rfc876)
211 System status, or system help reply
214 Help message
220 Service ready
221 Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to
354 Start mail input; end with .
421 Service not available, closing transmission channel
450 Requested mail action not taken: mailbox unavailable
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
521 does not accept mail (see rfc1846)
530 Access denied
550 Requested action not taken: mailbox unavailable
551 User not local; please try
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
554 Transaction failed

Reply codes grouped by command

Command Code Description
Code Meaning

connect
220 Service ready
421 Service not available, closing transmission channel

HELO
250 Requested mail action okay, completed
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
504 Command parameter not implemented
521 does not accept mail [rfc1846]
421 Service not available, closing transmission channel

EHLO
250 Requested mail action okay, completed
550 Not implemented
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
504 Command parameter not implemented
421 Service not available, closing transmission channel

MAIL
250 Requested mail action okay, completed
552 Requested mail action aborted: exceeded storage allocation
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
421 Service not available, closing transmission channel

RCPT
250 Requested mail action okay, completed
251 User not local; will forward to
550 Requested action not taken: mailbox unavailable
551 User not local; please try
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
450 Requested mail action not taken: mailbox unavailable
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
503 Bad sequence of commands
521 does not accept mail [rfc1846]
421 Service not available, closing transmission channel

DATA
354 Start mail input; end with .
451 Requested action aborted: local error in processing
554 Transaction failed
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
503 Bad sequence of commands
421 Service not available, closing transmission channel
received data
250 Requested mail action okay, completed
552 Requested mail action aborted: exceeded storage allocation
554 Transaction failed
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage

RSET
200 (nonstandard success response, see rfc876)
250 Requested mail action okay, completed
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
504 Command parameter not implemented
421 Service not available, closing transmission channel

SEND
250 Requested mail action okay, completed
552 Requested mail action aborted: exceeded storage allocation
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
421 Service not available, closing transmission channel

SOML
250 Requested mail action okay, completed
552 Requested mail action aborted: exceeded storage allocation
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
421 Service not available, closing transmission channel

SAML
250 Requested mail action okay, completed
552 Requested mail action aborted: exceeded storage allocation
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
421 Service not available, closing transmission channel

VRFY
250 Requested mail action okay, completed
251 User not local; will forward to
550 Requested action not taken: mailbox unavailable
551 User not local; please try
553 Requested action not taken: mailbox name not allowed
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
504 Command parameter not implemented
421 Service not available, closing transmission channel

EXPN
250 Requested mail action okay, completed
550 Requested action not taken: mailbox unavailable
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
504 Command parameter not implemented
421 Service not available, closing transmission channel

HELP
211 System status, or system help reply
214 Help message
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
504 Command parameter not implemented
421 Service not available, closing transmission channel

NOOP
200 (nonstandard success response, see rfc876)
250 Requested mail action okay, completed
500 Syntax error, command unrecognized
421 Service not available, closing transmission channel

QUIT
221 Service closing transmission channel
500 Syntax error, command unrecognized

TURN
250 Requested mail action okay, completed
502 Command not implemented
500 Syntax error, command unrecognized
503 Bad sequence of commands

Leave a Reply

Your email address will not be published. Required fields are marked *

*