"Pfad" Variable eingefügt
This commit is contained in:
parent
4ea3b21b5e
commit
364d649fa2
1 changed files with 6 additions and 4 deletions
10
send_Mail.py
10
send_Mail.py
|
|
@ -3,11 +3,14 @@ from email.mime.multipart import MIMEMultipart
|
|||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
import os
|
||||
|
||||
fromaddr = 'carsten.richter77@gmail.com'
|
||||
toaddr = 'carsten.richter77@gmail.com'
|
||||
|
||||
fobj = open("mpg/adressen.txt")
|
||||
pfad = os.path.dirname(__file__)
|
||||
|
||||
fobj = open(pfad+"/mpg/adressen.txt")
|
||||
bcc =[]
|
||||
for line in fobj:
|
||||
a = line.rstrip()
|
||||
|
|
@ -22,13 +25,12 @@ msg['From'] = fromaddr
|
|||
msg['To'] = toaddr
|
||||
msg['Subject'] = 'Hello World of Python-LISTENtest'
|
||||
|
||||
|
||||
body = 'Hello World again and again and again'
|
||||
|
||||
msg.attach(MIMEText(body, 'plain'))
|
||||
|
||||
filename = 'heute.pdf'
|
||||
attachment = open('mpg/heute.pdf','rb')
|
||||
attachment = open(pfad+'/mpg/heute.pdf','rb')
|
||||
|
||||
part = MIMEBase('application','octet-stream')
|
||||
part.set_payload((attachment).read())
|
||||
|
|
@ -38,7 +40,7 @@ part.add_header('Content-Disposition','attachment; filename= %s'% filename)
|
|||
msg.attach(part)
|
||||
|
||||
filename = 'morgen.pdf'
|
||||
attachment = open('mpg/morgen.pdf','rb')
|
||||
attachment = open(pfad+'/mpg/morgen.pdf','rb')
|
||||
|
||||
part = MIMEBase('application','octet-stream')
|
||||
part.set_payload((attachment).read())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue