covid msg and bcc

This commit is contained in:
ACM 2022-01-11 23:07:45 -05:00
parent ffe4075157
commit 97d0c62d9c
3 changed files with 14 additions and 7 deletions

View file

@ -479,6 +479,7 @@ def promote_from_waitlist():
msg = 'Dear ' + mlh_info['first_name'] + ',\n\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 += '**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'
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()
user = api_keys['smtp_email']['user']
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
if ('pass' in api_keys['smtp_email']):
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)
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['Subject'] = subject
msg['From'] = sender
if (bcc):
msg['Bcc'] = bcc
msg.add_header('reply-to', user)
if type(to) == list:
msg['To'] = ", ".join(to)

View file

@ -52,9 +52,9 @@ msg += ' ' + str(errs) + '\n'
print(msg)
# requests.post(WEBHOOK_URL, {
# "content": msg
# })
requests.post(WEBHOOK_URL, {
"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)

@ -1 +1 @@
Subproject commit bfb9d7799fbb8630f4351f043a05aa617964becf
Subproject commit b2a60294b8f9d37d8c486cd817f8260cc860caad