-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSend_emails.py
More file actions
25 lines (16 loc) · 749 Bytes
/
Send_emails.py
File metadata and controls
25 lines (16 loc) · 749 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
import smtplib
import email.mime.text as emt
from email.header import Header
smtp_server = 'smtp.gmail.com'
smtp_port = 587
smtp_username = '' # Your email
smtp_password = '' # Your app generated password
from_email = '' # Your email
to_emails = [] # Emails you want to send
msg = emt.MIMEText("", _charset = "UTF-8") # Body message (Note: if you don't want it in arabic language, just remove the second parameter)
msg['Subject'] = Header("", "UTF-8") # # Subject (Note: if you don't want it in arabic language, just remove the second parameter)
with smtplib.SMTP(smtp_server, smtp_port) as smtp:
smtp.starttls()
smtp.login(smtp_username, smtp_password)
for e in to_emails:
smtp.sendmail(from_email, e, msg.as_string())