My email sender wont add a email body message only a subject line in python

Viewed 8

Importing all the necessary requirements

from smtplib import SMTP
from my_email import email_mine , password_mine
from email_addresses import email1, email2

smtp_port = SMTP("smtp.gmail.com", 587)

smtp_port.ehlo()
smtp_port.starttls()
smtp_port.login(email_mine , password_mine)

creating body of message

subject = input("What is the Subject of this Mail?: ")
body = input("What is your message?: ")
final_message = f"Subject: {subject} \n \n {body}"

#list of emails

address_list = [email1, email2]
smtp_port.sendmail(email_mine, address_list, final_message)
print("Email Sent")
smtp_port.quit()
0 Answers
Related