Skip to content Skip to sidebar Skip to footer

Python Smtplib, How To Set A Subject

Ok, I'm trying to send a email with smtplib with the code which is working! But I don't know how to put a subject in, I've seen some other people here talk about it but the method

Solution 1:

import smtplib
import socket


message = f'Subject: {SUBJECT}\n\n{TEXT}'
server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()

Post a Comment for "Python Smtplib, How To Set A Subject"