From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Date: Fri, 4 Jul 2008 10:39:36 +0400 From: Alexey Morsov To: community@lists.altlinux.org Message-ID: <20080704063936.GA1601@ricom.ru> References: <486C9EDF.2010207@pochta.ru> <20080703140713.GA22790@ricom.ru> <486CE45C.2070807@pochta.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ftEhullJWpWg/VHq" Content-Disposition: inline In-Reply-To: <486CE45C.2070807@pochta.ru> User-Agent: Mutt/1.5.17 (2007-11-01) X-Virus-Scanned: by amavisd-new at ricom.ru Subject: Re: [Comm] =?utf-8?b?0KDQsNGB0YHRi9C70LrQsCDQv9C+0YfRgtGL?= X-BeenThere: community@lists.altlinux.org X-Mailman-Version: 2.1.10b3 Precedence: list Reply-To: ALT Linux Community general discussions List-Id: ALT Linux Community general discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2008 06:39:43 -0000 Archived-At: List-Archive: List-Post: --ftEhullJWpWg/VHq Content-Type: multipart/mixed; boundary="KsGdsel6WgEHnImy" Content-Disposition: inline --KsGdsel6WgEHnImy Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 03, 2008 at 06:38:20PM +0400, Ilya Raskin wrote: > =D0=90 =D0=BC=D0=BE=D0=B6=D0=BD=D0=BE =D0=BF=D0=BE=D0=B3=D0=BB=D1=8F=D0= =B4=D0=B5=D1=82=D1=8C =D0=BD=D0=B0 =D1=8D=D1=82=D0=BE =D1=87=D1=83=D0=B4=D0= =BE? > =D0=90 =D1=82=D0=BE =D0=B2=D1=81=D0=B5 =D1=87=D1=82=D0=BE =D0=B2=D1=80=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B8=D1=81=D1=82 =D0=97= =D0=90=D0=9E "=D0=98=D0=9A "=D0=A0=D0=B8=D0=BA=D0=BE=D0=BC-=D0=A2=D1=80=D0= =B0=D1=81=D1=82" Jabber: samurai@www.fondmarket.ru ALT Linux Team Member =D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4 =D0=BF=D0=B0=D0=BA=D1=82=D0=BE= =D0=B2 =D0=B8=D0=B7 =D1=80=D1=83=D0=BA =D0=B2 =D1=80=D1=83=D0=BA=D0=B8 =D0= =B2=D1=8B=D0=B7=D1=8B=D0=B2=D0=B0=D0=B5=D1=82 =D0=B4=D1=80=D0=B5=D0=B9=D1= =84 =D0=B1=D0=B0=D0=B3=D0=BE=D0=B2. -- at in devel@ --KsGdsel6WgEHnImy Content-Type: text/plain; charset=utf-8; name=massmail_example Content-Disposition: attachment; filename=massmail_example Content-Transfer-Encoding: quoted-printable #!/usr/bin/python #-*- mode: python; coding: koi8-r -*- import sys, os =66rom StringIO import StringIO import os import MySQLdb =66rom string import split, lstrip, rstrip =66rom email import * import smtplib def emailing(list_id, text, filename=3DNone, attach=3DNone, filetype=3DNone= ): msg =3D MIMEMultipart.MIMEMultipart() db =3D MySQLdb.connect(host=3D'', db=3D'', user=3D'', passwd=3D'') msg['Subject'] =3D Header.Header("=F4=C5=CD=C1 =D0=C9=D3=D8=CD=C1","koi8-r= ").encode() =20 msg['From'] =3D Utils.formataddr((Header.Header("=F7=C1=DB=C1 =CC=C0=C2=D1= =DD=C1=D1 =CB=CF=CD=D0=C1=CE=C9=D1","koi8-r").encode(), 'postmaster@yourdomain.com')) message =3D StringIO() message.write(text) txt =3D MIMEText.MIMEText(message.getvalue(),'plain','koi8-r') message.close() msg.attach(txt) if filename: doc =3D MIMEBase.MIMEBase('application',filetype) doc.set_payload(attach) Encoders.encode_base64(doc) doc.add_header('Content-Disposition', 'attachment', filename=3Dfilename) msg.attach(doc) # cycle through the emails of subscribers cur.execute("select email from youremaildtable") for line in cur.fetchall(): try: msg.replace_header('To',Utils.formataddr(('',line[0]))) except KeyError: msg['To'] =3D Utils.formataddr(('',line[0])) s =3D smtplib.SMTP() s.connect() try: s.sendmail('postmaster@yourdomain.com', line[0], msg.as_string()) except smtplib.SMTPRecipientsRefused, msg: s.sendmail('postmaster@yourdomain.com', 'postmaster@yourdomain.com',=20 "To: \nSubject: Maillist send error\n\n%s"%= (msg)) s.close() cur.close() db.close() def main(): buf =3D StringIO() map(buf.write,sys.stdin) msg =3D message_from_string(buf.getvalue()) buf.close() print rstrip(lstrip(split(msg.get('Return-Path'))[-1],'<'),'>') if rstrip(lstrip(split(msg.get('Return-Path'))[-1],'<'),'>') =3D=3D 'postm= aster@yourdomain.com': subj =3D Header.decode_header(msg.get('Subject'))[0][0] for part in msg.walk(): if part.get_content_type() =3D=3D 'text/plain': text =3D part.get_payload(decode=3D1) filetype =3D 'text' if part.get_content_type() =3D=3D 'application/msword': filename =3D Header.decode_header(part.get_filename())[0][0] attach =3D part.get_payload(decode=3D1) filetype =3D 'word' if part.get_content_type() =3D=3D 'application/pdf': filename =3D Header.decode_header(part.get_filename())[0][0] attach =3D part.get_payload(decode=3D1) filetype =3D 'pdf' else: filename =3D None attach =3D None filetype =3D None emailing(subj,text,filename,attach,filetype) if __name__ =3D=3D '__main__': main() --KsGdsel6WgEHnImy-- --ftEhullJWpWg/VHq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (GNU/Linux) iQEcBAEBAgAGBQJIbcWoAAoJEKYzuLoFSr5y2aEH/0XAxhyroRpd0ky65lZS90/P boiMkgxs0EKZOrmyCY2i+YHBkhFBQa2Wbim4aywuNtcwog/+bDTRPOqypvBFqFG+ AeiEKEOUL5CQQgKgSOUexWQV6fnvmTPElo/el5T6P2hmIhZwne8hSx9TCq0KcyWP CdBP2ybVNqMBgaA956GYgjrIbWlOWM2LybXiCO2QJMLcLqqRAfakSdJNDgFWdFE2 DP+ziI+rPXKr1V0ejbXIi6zFdPmy9ogOW6JIMHY/xVk1PPln2fIexoVXto2BmQLi loPaMfa/Rzb9/2uvGIfCHA2AGk6Sr4AzK584GPG90xxac04L1WY+YVEcwP8pimk= =m+G7 -----END PGP SIGNATURE----- --ftEhullJWpWg/VHq--