Skip to content

Commit 2f8288f

Browse files
Create EmailAutomation.py
1 parent 5c28c24 commit 2f8288f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

EmailAutomation.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import smtplib
2+
from email.mime.text import MIMEText
3+
4+
# Set the SMTP server and login credentials
5+
smtp_server = "smtp.gmail.com"
6+
smtp_port = 587
7+
username = "[email protected]"
8+
password = "yourpassword"
9+
10+
# Set the email parameters
11+
recipient = "[email protected]"
12+
subject = "Test email from Python"
13+
body = "This is a test email sent from Python."
14+
15+
# Create the email message
16+
msg = MIMEText(body)
17+
msg["Subject"] = subject
18+
msg["To"] = recipient
19+
msg["From"] = username
20+
21+
# Send the email
22+
server = smtplib.SMTP(smtp_server, smtp_port)
23+
server.starttls()
24+
server.login(username, password)
25+
server.send_message(msg)
26+
server.quit()

0 commit comments

Comments
 (0)