Sunday, April 15, 2012

Email Send Via telnet

Once you have some local users registered, try sending mail to one of them with SMTP (port 25).

$ telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 172.16.1.131 SMTP Server (JAMES SMTP Server 3.0-beta3) ready Sat, 6 Nov 2010 17:31:33 +0100 (CET)
ehlo test
250-172.16.1.131 Hello test (aoscommunity.com [127.0.0.1])
250-PIPELINING
250-ENHANCEDSTATUSCODES
250 8BITMIME
mail from:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.0 Sender <YOUR_NAME@YOUR_DOMAIN> OK
rcpt to:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.5 Recipient <YOUR_NAME@YOUR_DOMAIN> OK
data
354 Ok Send data ending with <CRLF>.<CRLF>
subject: test

this is a test
.
250 2.6.0 Message received
quit
Connection closed by foreign host.
Try now to retrieve that mail using POP3 (port 110) or IMAP (port 143).

Now, I got a test email via telnet.


If you need to tls connection with athentication. you will need to follow this. first you need base64 encoded username and password
$ echo -n "username@aaabb.com" | base64
dXNlcm5hbWVAYWFhYmIuY29t=
$ echo -n "password" | base64
cGFzc3dvcmQ=

openssl s_client -host <mx.mail.server> -port 587 -starttls smtp

AUTH LOGIN
334 VXNlcm5hbWU
<base64 encoded id>
334 UGFzc3dvcmQ6
<base64 encoded password>
235 2.7.0 Authentication successful
mail from:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.0 Ok
rcpt to:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.5 Recipient <YOUR_NAME@YOUR_DOMAIN> OK
data
From: "Name" <YOUR_NAME@YOUR_DOMAIN>
To: "Name" <YOUR_NAME@YOUR_DOMAIN>
subject: test

this is a test

.


250 2.0.0 Ok: queued as C71F02BC0B1
quit
221 2.0.0 Bye
closed


http://www.samlogic.net/articles/smtp-commands-reference.htm
https://www.heise.de/security/artikel/StartTLS-785453.html
http://base64-encoder-online.waraxe.us/

No comments:

Post a Comment