import smtplib from email.message import EmailMessage GMAIL_USER = "gulfemgulfemkurt@gmail.com" GMAIL_APP_PASSWORD = "" # no spaces or spaces both ok msg = EmailMessage() msg["Subject"] = "SMTP test from Python ✅" msg["From"] = GMAIL_USER msg["To"] = GMAIL_USER msg.set_content("If you received this email, Gmail SMTP works.") with smtplib.SMTP("smtp.gmail.com", 587) as smtp: smtp.ehlo() smtp.starttls() smtp.login(GMAIL_USER, GMAIL_APP_PASSWORD.replace(" ", "")) smtp.send_message(msg) print("✅ Email sent successfully")