Mercurial > hg > python
view sendpwf.py @ 59:c22f83e049a9 simple
check0 works for nono10,
but is broken in that col 3 w/o the row 7 hit would find the row 3 hit
as satisfying the last (2nd) run, which isn't _necessarily_ correct
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 03 Jun 2023 22:11:12 +0100 |
parents | 7d4da4e72d37 |
children |
line wrap: on
line source
#!/usr/bin/python3 """Send my encrypted pw files to joanna, james and emma""" from email.message import EmailMessage from email.policy import SMTP import smtplib, sys if len(sys.argv)>0 and sys.argv[1]=='-d': sys.argv.pop(1) debug=sys.argv.pop(1) else: debug=None date=sys.argv[1] m=EmailMessage(policy=SMTP) m['From']='ht@home.hst.name' m['To']="Emma JD Boland <emma.jd.boland@gmail.com>, James Thompson <jamesejthompson@gmail.com>, Joanna Thompson <joannat.is@gmail.com>" m['Cc']="Catharine Ward Thompson <catharine122@gmail.com>" m['Subject']='Monthly distro' m.set_content("""As promised ht """) for f in ['password_intro_%s.txt.gpg','passwords_%s.gpg']: ff=f%date with open(ff,'rb') as fp: data=fp.read() m.add_attachment(data, maintype='application', subtype='octet-stream', disposition='attachment', filename=ff) if debug: with open(debug,'wb') as dbf: dbf.write(m.as_bytes()) else: server=smtplib.SMTP('localhost') server.send_message(m) server.close()