473,421 Members | 1,652 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,421 software developers and data experts.

Sending e-mail with python 1.5.2

I am writing a CGI script on an account that only has Python 1.5.2. It's
principal purpose is to take some user input from a form, do some
manipulation and return some information to the user. However, I would
also like it to send some information to an e-mail account (behind the
scenes).

The e-mail could be quite simple, but I wouldn't rule out wanting to
send a pickled object or two.

Now if I was using a recent Python I would just use the email package,
but I don't think it's compatible with v1.5.2. I know I have access to
the sendmail binary, so something should be possible. Any pointers
gratefully received.

--
Andrew McLean
Jul 18 '05 #1
3 1521
I thought 1.5.2 had the smtp package. If not, how about just using
popen to send the mail through /bin/mail.
Jul 18 '05 #2
Thanks. smtplib was what I was looking for.

In article <7x************@ruckus.brouhaha.com>, Paul Rubin
<http@?.cx.invalid> writes
I thought 1.5.2 had the smtp package. If not, how about just using
popen to send the mail through /bin/mail.


--
Andrew McLean
Jul 18 '05 #3
Andrew McLean wrote:

I am writing a CGI script on an account that only has Python 1.5.2. It's
principal purpose is to take some user input from a form, do some
manipulation and return some information to the user. However, I would
also like it to send some information to an e-mail account (behind the
scenes).

The e-mail could be quite simple, but I wouldn't rule out wanting to
send a pickled object or two.

Now if I was using a recent Python I would just use the email package,
but I don't think it's compatible with v1.5.2. I know I have access to
the sendmail binary, so something should be possible. Any pointers
gratefully received.

--
Andrew McLean


This should help to get you going:

message = """\
Message-ID: <%(messageID)s>
Subject: %(subject)s
Date: %(date)s
From: %(fromstring)s <%(fromaddr)s>
Reply-To: %(fromaddr)s
X-Mailer: Python smtplib
%(to_cc_list)s

%(body)s
"""
try:
mail = smtplib.SMTP(LocalMailServer)
#mail.set_debuglevel(1)
mail.sendmail(fromaddr, email_recipients_tuple, message % locals())
mail.quit()
except:
print 'Could not send email!'

---

Richard.
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt....
1
by: coder_1024 | last post by:
I'm trying to send a packet of binary data to a UDP server. If I send a text string, it works fine. If I attempt to send binary data, it sends a UDP packet with 0 bytes of data (just the...
2
by: Joe | last post by:
Hi, I am sending an email from an asp page. Besides sending an email to sender, I am sending myself a BCC also. Out of 100 emails sent, about 5 recipients received a blank email (no text in...
3
by: Robert A. van Ginkel | last post by:
Hello Fellow Developer, I use the System.Net.Sockets to send/receive data (no tcpclient/tcplistener), I made a receivethread in my wrapper, the receivethread loops/sleeps while waiting for data...
4
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
3
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce...
9
by: Miro | last post by:
VB 2003 at the end of the code, this works great. bytCommand = Encoding.ASCII.GetBytes("testing hello send text") udpClient.Send(bytCommand, bytCommand.Length) and this recieves it Dim...
0
by: remya1000 | last post by:
by using FTP i can send files to server using vb.net. if the file is big, then it will take some time to complete the sending process to server.or if we were sending 3-4 files to the server one by...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.