
| Current Path : /proc/thread-self/root/home/cgabriel/20_office/1001__formulare/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //proc/thread-self/root/home/cgabriel/20_office/1001__formulare/mailvorlage.py |
# coding: utf8
import smtplib,os,re,sys,email.mime.text,email.mime.image,email.mime.multipart
msg = email.mime.multipart.MIMEMultipart()
msg['From'] = 'christian.gabriel@shortnote.de'
msg['Subject'] = "Konzertankuendigung"
# msg['To'] = 'christian.gabriel@shortnote.de'
# msg['Cc'] = 'christian.gabriel@shortnote.de'
try:
bcc = "" # BCCLIST
except:
bcc = "(" + re.sub(r"^.*----","",os.popen("oa1 PrMusik '\"-xMAIL-,\" +'").read(),flags=re.DOTALL) + '"")'
text = re.sub(r"BCCLIST",bcc,open(sys.argv[0]).read(),1)
open(sys.argv[0],"w").write(text)
exit()
# bcc = "christian.gabriel@shortnote.de"
mailtext = open(re.sub(r"\.py",".html",sys.argv[0])).read()
att = email.mime.text.MIMEText(re.sub(r"img +src=\"","img src=\"cid:",mailtext,999999),_subtype='html')
att.add_header('Content-Disposition','inline')
msg.attach(att)
attfiles = {}
while (0 == 0):
m = re.search(r"^.*?img +src=\"(.*?)\"(.*)$",mailtext,re.DOTALL)
if not m:
break
attfiles[m.group(1)] = 1
mailtext = m.group(2)
for attfile in attfiles:
att = email.mime.image.MIMEImage(open(attfile).read())
att.add_header('Content-Disposition','inline',filename=attfile)
att.add_header('Content-ID','<'+attfile+'>')
msg.attach(att)
sender = smtplib.SMTP()
receiver = []
if 'To' in msg: receiver = receiver + msg['To'].split(",")
if 'Cc' in msg: receiver = receiver + msg['Cc'].split(",")
if 'bcc' in vars(): receiver = receiver + bcc.split(",")
while '' in receiver: receiver.remove('')
sender.connect()
sender.sendmail(msg['From'],receiver,msg.as_string())
# os.rename(sys.argv[0],sys.argv[0]+".sent")