Skip to content

Instantly share code, notes, and snippets.

@goyuninfo
Created May 18, 2021 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goyuninfo/3b95f1e9631b283dc92b6074731c2771 to your computer and use it in GitHub Desktop.
Save goyuninfo/3b95f1e9631b283dc92b6074731c2771 to your computer and use it in GitHub Desktop.
import smtplib
import email.message, email.policy, email.utils, sys
text = """This is a test"""
message = email.message.EmailMessage(email.policy.SMTP)
message['To'] = 'noreply@goyun.info'
message['From'] = 'noreply@goyun.info'
message['Subject'] = 'A test email'
message['Date'] = email.utils.formatdate(localtime=True)
message['Message-ID'] = email.utils.make_msgid()
message.set_content(text)
smtp = smtplib.SMTP("smtp.goyun.info")
smtp.starttls()
smtp.login('noreply@goyun.info','password')
smtp.sendmail('noreply@goyun.info', 'test@goyun.info', message.as_string())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment