SMTP connection using telnet
May 2017
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
About
This site is an effort to share some of the base knowledge I have gathered through all this years working with Linux, FreeBSD, OpenBSD, Python or Zope, among others. So, take a look around and I hope you will find the contents useful.
Recent Entries
Recent Comments
Recent Trackbacks
Categories
OpenBSD (9 items)
BSD (0 items)
FreeBSD (19 items)
Linux (3 items)
Security (3 items)
Python (22 items)
Zope (13 items)
Daily (144 items)
e-shell (9 items)
Hacks (14 items)
PostgreSQL (3 items)
OSX (8 items)
Nintendo DS (0 items)
enlightenment (0 items)
Apache (3 items)
Nintendo Wii (1 items)
Django (24 items)
Music (12 items)
Plone (7 items)
Varnish (0 items)
Lugo (2 items)
Sendmail (0 items)
europython (7 items)
Cherokee (1 items)
self (1 items)
Nature (1 items)
Hiking (0 items)
uwsgi (0 items)
nginx (0 items)
cycling (9 items)
Networking (1 items)
DNS (0 items)
Archives

Syndicate this site (XML)

RSS/RDF 0.91

10 julio
2008

SMTP connection using telnet

another reminder for my damaged brain...

Did you ever need to test a SMTP server quickly?

If the answer is yes, probably you had hear something about using telnet to send emails directly.

I've used this trick a thousand times myself, but I always forget the correct commands and the order I have to provide them to the SMTP server.

Transcription follows:

[Fenris] ~> telnet mail.e-shell.org 25
Trying 212.89.9.184...
Connected to mail.e-shell.org.
Escape character is '^]'.
220 [ ESMTP Codigo23 mail server ] - [ Will Hack Unix for food ]
ehlo localhost
250-Frey.e-shell.org Hello cm82227.red.mundo-r.com [213.60.82.227], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 5242880
250-DSN
250-STARTTLS
250-DELIVERBY
250 HELP
mail from: you@yahoo.com
250 2.1.0 you@yahoo.com... Sender ok
rcpt to: jarjarthisisnotmymail@e-shell.org
250 2.1.5 jarjarthisisnotmymail@e-shell.org... Recipient ok
data
354 Enter mail, end with "." on a line by itself
This is a sample mail sent to you via telnet!
.
250 2.0.0 m6AB3LDP071599 Message accepted for delivery

Explanation:

1- Connect to the server using telnet:

telnet mail.e-shell.org 25

2- Say hello to the server:

ehlo localhost

3- Tell the server who is sending the email:

mail from: you@yahoo.com

4- Then tell it the destination address:

rcpt to: jarjarthisisnotmymail@e-shell.org

5- Finally tell the server you are about to write the message contents:

data

NOTE: If you want to add a subject to your mail, just add a line like:

Subject: this is my subject

at the beginning of the body. You will need to press enter twice for it to work properly.

6- Once you are done, push enter, then add a single dot (.) and push enter again.

7- Mail sent!

(Anyone who can teach us how to do that using netcat??)

Posted by wu at 11:11 | Comments (1) | Trackbacks (0)
<< Noticias en prensa escrita | Main | Debugging your webapp, the funny way >>
Comments
Re: SMTP connection using telnet

Hi There,

Thanks for a great tutorial but i have a question for you.

The 1st step where you connect to the server, how do you identify the server whe using an internet cafe?

Please help.
Your co-operation will be appreciated.

Regards

Posted by: Sifiso at noviembre 04,2008 08:33
Re: SMTP connection using telnet

Hi Sifiso, I don't know exactly what do you meant with "how do you identify the server whe using an internet cafe?" but you can use tools like dig (if you are using a unix-like operating system like linux or bsd) or nslookup (if you are using windows) to know the FQDN or the ip address of the MX record for a given domain.

For example, if you want to know the name of the mail server for the domain e-shell.org, with dig you can do something like:

dig e-shell.org MX

Just use google and search for dig, dig MX or nslookup and you will probably find what you need.

Posted by: Wu at noviembre 04,2008 11:58
Re: SMTP connection using telnet

E-Shell is not working anymore. Any Idea?

Posted by: Falcon at febrero 25,2015 12:01
Trackbacks
Please send trackback to:http://blog.e-shell.org/81/tbping
There are no trackbacks.
Post a comment