473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 5172
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gerhard Häring | last post by:
On my mailserver (running a recent Postfix snapshot) I get this since a few hours: mylene:/var# mailq -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- DA10713E37 1617 Wed...
2
by: anyab5 | last post by:
hey I need help in sending email, It seems that while using this set of commands from smtplib import SMTP s = SMTP() s.set_debuglevel(1) s.connect('outmail.huji.ac.il')
2
by: vmalhotra | last post by:
Hi I am new in python scripting. I want to open a Multiple telnet session through once script. In other way i can tell i want to open two linux consoles through one script. I wrote one...
14
by: sridhar | last post by:
iam having user account on an exchangeserver. with that can i send an email using python? if iam using the following code iam getting error fromAddress = 'sridhar_kasturi@satyam.com'...
8
by: Robert Dufour | last post by:
Dim message As New MailMessage("mymail@mydomain.com", "mymail@mydomain.com", "Test", "Test") Dim emailClient As New SmtpClient("localhost") emailClient.Send(message) The IIS server is...
1
by: apasj06 | last post by:
hello everyone: I am trying to send email via php. I using window XP home edition. My mail client is outlook express. I configured mail client to send email via my aol email account. mail...
0
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
2
by: Sonnich Jensen | last post by:
Hi all! I use the following for sending mail from ASP, but there is a problem - it goes to a intranet thing (eRoom) which does not read it, while Outlook etc does not have any problems. eRoom...
5
by: sui | last post by:
this is my code import sys, os, glob, datetime, time import smtplib ## Parameters for SMTP session port=587 SMTPserver= 'smtp.gmail.com' SMTPuser= '...@gmail.com' pw= 'fill in here'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.