Hallo
Ich versende mit sendmail unter Python3 eine Textdatei als Anhang. Dieser kommt unter Ubuntu sowohl in Evolution als auch in Thunderbird nicht als Anhang an sondern ist im Textkörper.
Wenn ich diese Datei von Evolution nach Thunderbird oder umgekehrt versende, kommt er sehr wohl als Anhang an. Was läuft da falsch?
Python
#!/usr/bin/env python3
import smtplib
smtp = smtplib.SMTP("smtp.world4you.com")
smtp.login"ich@du.net", "Passwort")
(235, '2.0.0 Authentication successful')
# Senden Email mit anhang
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
from email.mime.text import MIMEText
msg = MIMEMultipart()
msg["Subject"] = "Umläüte"
msg["From"] = "Raspberry <ich@du.net>"
msg["To"] = "Empfänger<empfaenger.bist@du.net"
absender="ich@du.net"
empfaenger="empfaenger.bist@du.net"
text = MIMEText("aouAOU\näöüÄÖÜ")
msg.attach(text)
f = open("test1.txt")
textdatei = MIMEText(f.read())
f.close()
msg.attach(textdatei)
msg['Content-Type']="text/html; charset=utf8"
smtp.sendmail(absender,empfaenger,msg.as_string())
{}
smtp.quit()
Alles anzeigen