On Fri, 8 Jul 2005 07:49:25 +0100 (BST), praba kar <[EMAIL PROTECTED]> wrote:
> Dear All,
>       Normally we can send mail using
> telnet in linux. In the following way
> [~user]telnet Ipaddress 25
> mail from: [EMAIL PROTECTED]
> 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!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to