-
-
Save anonymous/44906d8b2ad24bbd242b5e3e4735722f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
import sys | |
from email.mime.text import MIMEText | |
from email.header import Header | |
# Absender-Adresse | |
frm = 'from@domain' | |
# Empfänger-Adresse | |
to = 'empfaenger@domain' | |
# SMTP-Zugangsdaten | |
smtpHost = 'smtpauth.bluewin.ch' | |
smtpPort = 587 | |
smtpUser = 'username (=sender email)' | |
smtpPassword = 'passwort' | |
subj = 'from raspberry' | |
msg = 'Test' | |
mime = MIMEText(msg, 'plain', 'utf-8') | |
mime['From'] = frm | |
mime['To'] = to | |
mime['Subject'] = Header(subj, 'utf-8') | |
try: | |
smtp = smtplib.SMTP(smtpHost, smtpPort) | |
#smtp.starttls() | |
smtp.login(smtpUser, smtpPassword) | |
smtp.sendmail(frm, to, mime.as_string()) | |
smtp.quit() | |
except: | |
print('Fehler', sys.exc_info()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment