subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tech Geek <techgeek12...@gmail.com>
Subject Re: Sending attachments in email using mailer.py script
Date Wed, 06 Oct 2010 22:58:21 GMT
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.

Mime
View raw message