-
Notifications
You must be signed in to change notification settings - Fork 104
/
bulk_email_automation.py
36 lines (27 loc) · 976 Bytes
/
bulk_email_automation.py
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
27
28
29
30
31
32
33
34
35
36
import smtplib
def getting_login_credentials():
email = input("Enter your email address")
password = input("Enter password")
return email, password
def getting_senders_email_address():
n = int(input("enter the number of users"))
emails = []
for i in range(n):
email = input("enter the email")
emails.append(email)
return emails
def getting_message_to_send():
message = input("Enter the message")
return message
def sending_automated_mails(email, password, receiver_emails, message):
smtp = smtplib.SMTP("smtp.gmail.com", 587)
smtp.ehlo()
smtp.starttls()
smtp.login(email, password)
to = receiver_emails
smtp.sendmail(from_addr=email, to_addrs=to, msg=message)
smtp.quit()
email, password = getting_login_credentials()
receiver_emails = getting_senders_email_address()
message = getting_message_to_send()
sending_automated_mails(email, password, receiver_emails, message)