[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Sending attachments in email using mailer.py script

From: Tech Geek <techgeek12345_at_gmail.com>
Date: Wed, 6 Oct 2010 15:58:21 -0700

I guess my biggest hurdle at this time is how to extract the file from the
repository that I would like to send it as an attachment.

Most of the examples on the net simply specifies an explicit filename (to
show as an example) like this:
*********************************************************************************
#!/usr/bin/python
import smtplib
......
filename = "/tmp/test.txt"
.....
# Define the attachment section
part3 = """Content-Type: multipart/mixed; name=\"%s\"
Content-Transfer-Encoding:base64
Content-Disposition: attachment; filename=%s
.......
%s
--%s--
""" %(filename, filename, encodedcontent, marker)
message = part1 + part2 + part3
try:
   smtpObj = smtplib.SMTP('localhost')
   smtpObj.sendmail(sender, reciever, message)
   print "Successfully sent email"
except Exception:
   print "Error: unable to send email"

*********************************************************************************
So basically I would want the path
/var/lib/svn/projectA/tags/REL-1.0/source.zip in the filename variable.
Received on 2010-10-07 00:58:59 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.