Created
April 9, 2025 19:12
-
-
Save Quantum-Codes/f10210111c2177375bf35bff7e2b3040 to your computer and use it in GitHub Desktop.
SMTP Emailing
This file contains hidden or 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 | |
from email.message import EmailMessage | |
s = smtplib.SMTP('smtp.gmail.com', 587) | |
# Authentication | |
s.starttls() | |
s.login("<sender_email>", "<app_password>") | |
msg = EmailMessage() | |
msg['Subject'] = "" | |
msg['From'] = "<sender_email>" | |
msg['To'] = "" | |
msg.set_content("""html code""", subtype='html') | |
s.send_message(msg) | |
s.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment