covid msg and bcc
This commit is contained in:
parent
ffe4075157
commit
97d0c62d9c
3 changed files with 14 additions and 7 deletions
11
flask_app.py
11
flask_app.py
|
@ -479,6 +479,7 @@ def promote_from_waitlist():
|
||||||
msg = 'Dear ' + mlh_info['first_name'] + ',\n\n'
|
msg = 'Dear ' + mlh_info['first_name'] + ',\n\n'
|
||||||
msg += 'You are off the waitlist!\n'
|
msg += 'You are off the waitlist!\n'
|
||||||
msg += 'Room has opened up, and you are now welcome to come, we look forward to seeing you!\n'
|
msg += 'Room has opened up, and you are now welcome to come, we look forward to seeing you!\n'
|
||||||
|
msg += '**Note** Please see https://hack.wpi.edu and the event Slack for important information regarding the event format in accordance with new COVID safety guidelines\n'
|
||||||
msg += 'If you cannot make it, please drop your application at https://hack.wpi.edu/dashboard.\n'
|
msg += 'If you cannot make it, please drop your application at https://hack.wpi.edu/dashboard.\n'
|
||||||
send_email(mlh_info['email'], "Hack@WPI - You're off the Waitlist!", msg)
|
send_email(mlh_info['email'], "Hack@WPI - You're off the Waitlist!", msg)
|
||||||
|
|
||||||
|
@ -553,20 +554,26 @@ def send_email(to, subject, body):
|
||||||
server.starttls()
|
server.starttls()
|
||||||
user = api_keys['smtp_email']['user']
|
user = api_keys['smtp_email']['user']
|
||||||
sender = api_keys['smtp_email']['sender']
|
sender = api_keys['smtp_email']['sender']
|
||||||
|
# Get bcc info if it exists
|
||||||
|
bcc = None
|
||||||
|
if ('bcc' in api_keys['smtp_email']):
|
||||||
|
bcc = api_keys['smtp_email']['bcc']
|
||||||
# Login if we're using server with auth
|
# Login if we're using server with auth
|
||||||
if ('pass' in api_keys['smtp_email']):
|
if ('pass' in api_keys['smtp_email']):
|
||||||
server.login(user, api_keys['smtp_email']['pass'])
|
server.login(user, api_keys['smtp_email']['pass'])
|
||||||
|
|
||||||
msg = _create_MIMEMultipart(subject, sender, to, body, user)
|
msg = _create_MIMEMultipart(subject, sender, to, body, user, bcc)
|
||||||
|
|
||||||
server.send_message(msg)
|
server.send_message(msg)
|
||||||
print("Sucess! (Email to " + to)
|
print("Sucess! (Email to " + to)
|
||||||
|
|
||||||
|
|
||||||
def _create_MIMEMultipart(subject, sender, to, body, user=None):
|
def _create_MIMEMultipart(subject, sender, to, body, user=None, bcc=None):
|
||||||
msg = MIMEMultipart()
|
msg = MIMEMultipart()
|
||||||
msg['Subject'] = subject
|
msg['Subject'] = subject
|
||||||
msg['From'] = sender
|
msg['From'] = sender
|
||||||
|
if (bcc):
|
||||||
|
msg['Bcc'] = bcc
|
||||||
msg.add_header('reply-to', user)
|
msg.add_header('reply-to', user)
|
||||||
if type(to) == list:
|
if type(to) == list:
|
||||||
msg['To'] = ", ".join(to)
|
msg['To'] = ", ".join(to)
|
||||||
|
|
|
@ -52,9 +52,9 @@ msg += ' ' + str(errs) + '\n'
|
||||||
|
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
# requests.post(WEBHOOK_URL, {
|
requests.post(WEBHOOK_URL, {
|
||||||
# "content": msg
|
"content": msg
|
||||||
# })
|
})
|
||||||
|
|
||||||
# send_email('hack@wpi.edu', 'HackWPI - Daily Waitlist Report!', msg)
|
send_email('hack@wpi.edu', 'HackWPI - Daily Waitlist Report!', msg)
|
||||||
send_email('mikel@wpi.edu', 'HackWPI - Daily Waitlist Report!', msg)
|
send_email('mikel@wpi.edu', 'HackWPI - Daily Waitlist Report!', msg)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit bfb9d7799fbb8630f4351f043a05aa617964becf
|
Subproject commit b2a60294b8f9d37d8c486cd817f8260cc860caad
|
Loading…
Add table
Reference in a new issue