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

Re: dated-mailer.py

From: <kfogel_at_collab.net>
Date: 2005-06-04 22:17:49 CEST

Did you mean to send this to svn-breakage@ ? :-)

-Karl

carl@personnelware.com writes:
> #!/usr/bin/env python
>
> import smtplib
> import sys
> import base64
> import os
> import time
>
> # Usage: mail-nightly-build.py SUBJECT FILENAME
> # mails the contents of FILENAME to svn-breakage@ list.
>
> # Adjust these globals as needed:
>
> to_address = "svn-breakage@subversion.tigris.org"
> # to_address = "carl@personnelware.com"
> from_address = "carl@personnelware.com"
> # SMTP_server = "smtp.tigris.org"
> SMTP_server = "contact"
> # SMTP_server = "localhost"
>
> # The huuuuuuuuuuge program:
>
> if len(sys.argv) < 3:
> print "Usage: %s SUBJECT FILENAME [ATTACHMENT ...]" % sys.argv[0]
> sys.exit(1)
>
> subject = sys.argv[1]
> filename = sys.argv[2]
> mime_boundary = "----------------=_NEXT_PART_123456789"
>
>
> msg = "MIME-Version: 1.0\n" \
> "Content-Type: multipart/mixed; boundary=\"%s\"\n" \
> "From: %s\nTo: %s\nSubject: %s\n" \
> "Date: %s\n\n" \
> "--%s\nContent-Type: text/plain; charset=us-ascii\n" \
> "Content-Transfer-Encoding: 8bit\nContent-Disposition: inline\n\n" \
> % (mime_boundary, \
> from_address, to_address, subject, \
> time.strftime('%c'), \
> mime_boundary)
>
> fp = open(filename, 'r')
> contents = fp.read()
> fp.close()
>
> msg += contents + "\n--%s\n" % mime_boundary
>
> for arg in sys.argv[3:]:
> fp = open(arg, 'rb')
> contents = fp.read()
> fp.close()
> msg += "Content-Type: application/x-gzip\n" \
> "Content-Disposition: attachment; filename=\"%s\"\n" \
> "Content-Transfer-Encoding: base64\n\n" \
> "%s\n\n--%s\n" % (os.path.basename(arg), \
> base64.encodestring(contents), mime_boundary)
>
> server = smtplib.SMTP(SMTP_server)
> server.sendmail(from_address, to_address, msg)
> server.quit()

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jun 4 22:58:37 2005

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

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