Skip to content

Instantly share code, notes, and snippets.

@mwicat
Created April 26, 2021 12:54
Show Gist options
  • Save mwicat/257e0aa0e8609ac1156f8f0197b07665 to your computer and use it in GitHub Desktop.
Save mwicat/257e0aa0e8609ac1156f8f0197b07665 to your computer and use it in GitHub Desktop.
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
import sys
msg = MIMEMultipart()
server = sys.argv[1]
from_addr = sys.argv[2]
to_addr = sys.argv[3]
msg['From'] = from_addr
msg['To'] = to_addr
msg['Subject'] = 'test email content'
message = 'test email subject'
msg.attach(MIMEText(message))
mailserver = smtplib.SMTP(server, 25)
mailserver.sendmail(from_addr, to_addr, msg.as_string())
mailserver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment