Last active
August 18, 2020 09:36
-
-
Save benjaminguinaudeau/9810efef3179e12474eda01d81b380c5 to your computer and use it in GitHub Desktop.
Send email with uni konstanz account
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
#!/usr/bin/env python | |
import smtplib | |
from email.mime.text import MIMEText | |
def send_mail_starttls(sender = '', to = '', pwd = '', subject = '', msg = ''): | |
recipients = [to, sender] | |
msg = MIMEText(msg) | |
msg['Subject'] = subject | |
msg['From'] = sender | |
msg['To'] = to | |
with smtplib.SMTP("smtp.uni-konstanz.de", 587) as server: | |
server.starttls() # Secure the connection | |
server.login(sender, pwd) | |
server.sendmail(sender, recipients, msg.as_string()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment