0

I successfully sent an email but the subject didn't show for me

connection = smtplib.SMTP("smtp.gmail.com", 587)
connection.starttls()
connection.login(user=mail, password=pwd)
msg = EmailMessage()
msg["From"] = mail
msg["To"] = t.get()
msg["Subject"] = subject
text = msg.as_string()
msg.attach(MIMEText(s.get()))
msg.set_content(subject)
connection.sendmail(e.get(), t.get(), text)
messagebox.showinfo("Email Sending", f"Mail sent to {t.get()}")
connection.quit()

this is just part of the code i'm creating a email client with TKinter, help me out ;-;

The email just sent with only mail text (no subject)

  • may be you can use this - https://stackoverflow.com/questions/4782068/can-i-set-subject-content-of-email-using-mailto?rq=2 – suraj sharma Jun 10 '23 at 05:34
  • 1
    What have you done to debug this? have you verified that `subject` is set to a non-empty string? What if you completely eliminate tkinter from this example and hard-code the strings. Does it work then? – Bryan Oakley Jun 10 '23 at 07:20

0 Answers0