Skip to content

Commit 4807d3e

Browse files
committed
mail sender now asks for password
1 parent 8628a22 commit 4807d3e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

assembler/src/tools/mail_sender/mail_sender.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
import sys
1212
import sendgrid
1313

14-
def send_messages(user_list, subject, text):
14+
def send_messages(username, password, user_list, subject, text):
1515
i = 0
1616
for address in user_list:
1717
i += 1
1818
print '\rSending ' + str(i) + '/' + str(len(user_list)),
1919
sys.stdout.flush()
20-
send_message(address, subject, text)
20+
send_message(username, password, address, subject, text)
2121
print '\nDone'
2222

23-
def send_message(address, subject, text):
24-
sg = sendgrid.SendGridClient("spades", "5phGnoqf2n")
23+
def send_message(username, password, address, subject, text):
24+
sg = sendgrid.SendGridClient(username, password)
2525
message = sendgrid.Mail()
2626

2727
message.add_to(address)
@@ -75,7 +75,9 @@ def save_user_list(file_name, email_list):
7575

7676
send = raw_input('Are you sure you want to send the message with subject "' + subject + '" to ' + str(len(user_set)) + ' users? (yes/no) ')
7777
if (send.strip().upper() == 'YES'):
78-
send_messages(user_set, subject, message)
78+
username = raw_input('Username: ')
79+
password = raw_input('Password: ')
80+
send_messages(username, password, user_set, subject, message)
7981
else:
8082
print("Aborted")
8183

0 commit comments

Comments
 (0)