From 4ea3b21b5eed197f13386a6520858caeb9846d83 Mon Sep 17 00:00:00 2001 From: hubobel Date: Tue, 10 Oct 2017 18:01:37 +0200 Subject: [PATCH] =?UTF-8?q?Passwort=20wird=20nun=20als=201.Eintrag=20in=20?= =?UTF-8?q?der=20"Adressen.txt"=20erwartet,=20hier=20folgen=20dann=20Zeile?= =?UTF-8?q?=20f=C3=BCr=20Zeile=20die=20Empf=C3=A4nger=20(BCCs)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- send_Mail.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/send_Mail.py b/send_Mail.py index 4e24a84..e910f6d 100644 --- a/send_Mail.py +++ b/send_Mail.py @@ -5,15 +5,22 @@ from email.mime.base import MIMEBase from email import encoders fromaddr = 'carsten.richter77@gmail.com' -bcc = ['schneeschieben@web.de', 'carsten@hubobel.de', 'johanna.richter.vogt@googlemail.com', 'crichter@soka-bau.de'] toaddr = 'carsten.richter77@gmail.com' -pwd = 'xxxxxxxx' + +fobj = open("mpg/adressen.txt") +bcc =[] +for line in fobj: + a = line.rstrip() + bcc.append(a) +fobj.close() + +pwd = bcc[0] msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr -msg['Subject'] = 'Hello World of Python-test2' +msg['Subject'] = 'Hello World of Python-LISTENtest' body = 'Hello World again and again and again' @@ -44,6 +51,6 @@ server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(fromaddr,pwd) text = msg.as_string() -server.sendmail(fromaddr, bcc, text) +server.sendmail(fromaddr, bcc[1:], text) server.quit()