Merge branch 'master' of ssh://github.com/wpi-acm/Hack-WPI-Python
This commit is contained in:
commit
10e623f899
2 changed files with 13 additions and 6 deletions
11
flask_app.py
11
flask_app.py
|
@ -519,6 +519,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)
|
||||
|
||||
|
@ -593,20 +594,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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue