-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail_auto.py
More file actions
21 lines (18 loc) · 790 Bytes
/
email_auto.py
File metadata and controls
21 lines (18 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import smtplib
import ssl
from email.message import EmailMessage
Email = "shidhartsharma183@gmail.com"
App_password = "xxxxxxxx" # Use an app password for security
Recivier_email = "latashrma592@gmail.com"
msg = EmailMessage()
msg['From'] = Email
msg['To'] = Recivier_email
msg['Subject'] = "Test email from python"
msg.set_content("This is a test email sent from a Python script using smtplib and EmailMessage.")
msg.set_content("This is a test email sent from a Python script using smtplib and EmailMessage.")
context = ssl.create_default_context()
with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as server:
server.login(Email, App_password)
server.send_message(msg)
print("Email sent successfully!")
print("Email sent successfully!")