-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail.py
More file actions
26 lines (20 loc) · 714 Bytes
/
Copy pathemail.py
File metadata and controls
26 lines (20 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import smtplib
from email.mime.text import MIMEText
# Your Gmail details
sender_email = "mugleshiv1531@gmail.com"
app_password = "fcuh lqtt lmke natp"
# Receiver email
receiver_email = "shivmugle1531@gmail.com"
# Email content
message = MIMEText("Hello! This email is sent using Python.")
message["Subject"] = "Python Email Test"
message["From"] = sender_email
message["To"] = receiver_email
# Gmail SMTP connection
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls() # Secure connection
server.login(sender_email, app_password)
# Send email
server.sendmail(sender_email, receiver_email, message.as_string())
server.quit()
print(" Email sent successfully!")