From users-return-5205-apmail-subversion-users-archive=subversion.apache.org@subversion.apache.org Wed Oct 06 22:58:50 2010 Return-Path: Delivered-To: apmail-subversion-users-archive@minotaur.apache.org Received: (qmail 38974 invoked from network); 6 Oct 2010 22:58:50 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Oct 2010 22:58:50 -0000 Received: (qmail 78082 invoked by uid 500); 6 Oct 2010 22:58:49 -0000 Delivered-To: apmail-subversion-users-archive@subversion.apache.org Received: (qmail 78061 invoked by uid 500); 6 Oct 2010 22:58:49 -0000 Mailing-List: contact users-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@subversion.apache.org Received: (qmail 78054 invoked by uid 99); 6 Oct 2010 22:58:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Oct 2010 22:58:49 +0000 X-ASF-Spam-Status: No, hits=4.4 required=10.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of techgeek12345@gmail.com designates 74.125.82.171 as permitted sender) Received: from [74.125.82.171] (HELO mail-wy0-f171.google.com) (74.125.82.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Oct 2010 22:58:42 +0000 Received: by wyf19 with SMTP id 19so117723wyf.16 for ; Wed, 06 Oct 2010 15:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=CL8G71n7W9z9DoAMBwgrBC0HOlZ+5wL08IPFrDw92Lc=; b=t0io0y8PaJ//R+wwsO1A++mS4XcAOPdETvLutKrii0QZnTlvnWGATpZKFfeB63BLFP pSYC0vNRO6mGkOWa7u5bDfTrQfPEHPCk24iD5hOLxiemuvBvXfk4gywY9txU3bh1gI5A bB3mPQFpOencjgF+9SP3Vrzqn3G7AvPR/ndRE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Mr9M6QkDE+qjfvBwGnwgWlKRbNY4g5SLC1YaKKtOioADaZNhDRldzVWm9SOa36i5LS dqIR3aMbz8cicNOakHX+dcPOL8HdxNiK1fqLfZKmRC4Us/8TrjXfU3tqmRO+bigxerAk PIU0d/ahjuSGW2NC70ekW3X9SYawlPvRh1Uno= MIME-Version: 1.0 Received: by 10.216.7.129 with SMTP id 1mr11265346wep.90.1286405901511; Wed, 06 Oct 2010 15:58:21 -0700 (PDT) Received: by 10.216.28.135 with HTTP; Wed, 6 Oct 2010 15:58:21 -0700 (PDT) In-Reply-To: References: Date: Wed, 6 Oct 2010 15:58:21 -0700 Message-ID: Subject: Re: Sending attachments in email using mailer.py script From: Tech Geek To: Ted Stern Cc: Subversion Users Content-Type: multipart/alternative; boundary=0016364c74a5cbec5d0491fab62c X-Virus-Checked: Checked by ClamAV on apache.org --0016364c74a5cbec5d0491fab62c Content-Type: text/plain; charset=ISO-8859-1 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. --0016364c74a5cbec5d0491fab62c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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.
=A0
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 =3D "/t= mp/test.txt"
.....
# Define the attachment section
part3 =3D = """Content-Type: multipart/mixed; name=3D\"%s\" Content-Transfer-Encoding:base64
Content-Disposition: attachment; filena= me=3D%s
.......
%s
--%s--
""" %(filename, filena= me, encodedcontent, marker)
message =3D part1 + part2 + part3
try:
=A0=A0 smtpObj =3D smtplib.SMTP('localhost')
=A0=A0= smtpObj.sendmail(sender, reciever, message)
=A0=A0 print "Successf= ully sent email"
except Exception:
=A0=A0 print "Error: una= ble to send email"
**********************************************************************= ***********
So basically I would want the path /var/lib/svn/projectA/tags/REL-1.0/= source.zip in the filename variable.
=A0
=A0
--0016364c74a5cbec5d0491fab62c--