email_user = 'sender@gmail.com' email_pass = 'password' smtp_url = "smtp.gmail.com:587" def send_email(price): try: s = smtplib.smtp(smtp_url) s.ehlo() s.starttls() s.ehlo() s.login(email_user, email_pass) except smtplib.smtpauthenticationerror: print("failed login") else: print("logged in! composing message..") msg = mimemultipart("alternative") msg["subject"] = "subject" msg["from"] = email_user msg["to"] = 'recipient@gmail.com' text = "hello recipient" part = mimetext(text, "plain") msg.attach(part) s.sendmail(email_user, email_user, msg.as_string()) print("message has been sent.")
i'm using above script send email sender@gmail.com recipient@gmail.com (both owned me). weird thing happens - see email in sender@gmail.com's sent folder, email isn't received recipient@gmail.com (i checked spam folder well). experienced before? know solution?
Comments
Post a Comment