469,645 Members | 1,595 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

mail sending using telnet in python

Dear All,
Normally we can send mail using
telnet in linux. In the following way
[~user]telnet Ipaddress 25
mail from: ra*@rajkumar.com
250 o.k(response of from commandline)
rcpt to: te**@oops.co.in
250 o.k(response of from commandline)
data
354 go ahead(response of from commandline)
Hello world(message to send)
..
250 ok 1120805818 qp 1463

Is it possible to run same thing same manner
in python? If possible kindly help me with
specimen code. Actually I gone through
telnetlib module documentation but I cann't
get solution for it.

regards
prabahar



__________________________________________________ ________
Free antispam, antivirus and 1GB to save all your messages
Only in Yahoo! Mail: http://in.mail.yahoo.com
Jul 21 '05 #1
4 4773
praba kar wrote:
Dear All,
Normally we can send mail using
telnet in linux. In the following way Is it possible to run same thing same manner
in python? If possible kindly help me with
specimen code. Actually I gone through
telnetlib module documentation but I cann't
get solution for it.


Why not just use the smtp module? It's a tad easier.

--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science
Jul 21 '05 #2
On Fri, 8 Jul 2005 07:49:25 +0100 (BST), praba kar <pr*********@yahoo.co.in> wrote:
Dear All,
Normally we can send mail using
telnet in linux. In the following way
[~user]telnet Ipaddress 25
mail from: ra*@rajkumar.com
250 o.k(response of from commandline) ....

That is sometimes a very useful trick, but it doesn't always work. SMTP
requires CR-LF line endings, but your example only generates LF. Most mail
servers accept that, but they are not required to, and some don't (qmail?).
Is it possible to run same thing same manner
in python? If possible kindly help me with
specimen code. Actually I gone through
telnetlib module documentation but I cann't
get solution for it.


When you use the telnet command to do it, you're simply abusing telnet to
get a command-line interface to a TCP socket -- it's really only intended to
talk to a telnet server. . If the 'netcat' utility was more widespread,
everyone would have used it instead.

When you use Python, it doesn't make sense to go through telnetlib. Use
module socket instead.

Or, simply use module smtplib, which also comes with example code (in Python
2.3, at least).

Have fun,
Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
Jul 21 '05 #3
>>>>> praba kar <pr*********@yahoo.co.in> (PK) wrote:
PK> Normally we can send mail using
PK> telnet in linux. In the following way
PK> [~user]telnet Ipaddress 25


In fact you are using SMTP through the telnet program. So in Python use
the smtplib module.
--
Piet van Oostrum <pi**@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP E17999C4]
Private email: pi**@vanoostrum.org
Jul 21 '05 #4
praba kar enlightened us with:
Is there any php equivalent move_uploaded_file($source_path,
"$upload_dir/$name"); function in python to upload a file to server?
move_uploaded_file does NOT upload a file to a server.
Kindly give me answer.


Kindly ask answerable question.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Gerhard Häring | last post: by
2 posts views Thread by anyab5 | last post: by
2 posts views Thread by vmalhotra | last post: by
14 posts views Thread by sridhar | last post: by
8 posts views Thread by Robert Dufour | last post: by
1 post views Thread by apasj06 | last post: by
2 posts views Thread by Sonnich Jensen | last post: by
5 posts views Thread by sui | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.