supercontest.comms.email
Email-related utilities. These functions all respect user notification preferences.
Module Attributes
The mail object used throughout the app to send email. |
Functions
Emails an image of the table of all the league picks for the week. |
|
Emails a user a list of teams. |
|
Emails all subscribed users that lockdown is about to happen. |
|
Emails all subscribed users that new lines have been posted. |
|
Defined with a function instead of a constant so it's not invoked at import, where |
|
Send email to any number of users, via bcc. |
- supercontest.comms.email.email_all_picks(season: int, week: int, png: str)
Emails an image of the table of all the league picks for the week.
- Parameters:
season – Goes in the subject of the email.
week – Goes in the subject of the email.
png – Path to the png to be attached.
- supercontest.comms.email.email_picks(season: int, week: int, teams: list[str], emails: list[str], email_admin: bool = True)
Emails a user a list of teams. This is usually to notify the single user that their late picks have been submitted.
- Parameters:
season – Goes in the subject of the email.
week – Goes in the subject of the email.
teams – The names of the teams to send.
emails – The regular recipients of the email.
email_admin – If
True, sends an identical email to notify the admin.
- supercontest.comms.email.email_picks_closing(season: int | None, week: int | None, unfinished_pickers: list[str])
Emails all subscribed users that lockdown is about to happen.
- Parameters:
season – Goes in the subject of the email.
week – Goes in the subject of the email.
unfinished_pickers – All users who have not submitted 5 picks. This function does not calculate it, of course - it’s just passed.
- supercontest.comms.email.email_picks_open(season: int | None, week: int | None)
Emails all subscribed users that new lines have been posted.
- Parameters:
season – Goes in the subject of the email.
week – Goes in the subject of the email.
Defined with a function instead of a constant so it’s not invoked at import, where
url_forerrors without an app context.- Returns:
Common email footer for the app.
- supercontest.comms.email.mail = <flask_mail.Mail object>
The mail object used throughout the app to send email.
- supercontest.comms.email.send_mail(subject: str, body: str, recipients: list[str], png_attachment: str | None = None, batch_size: int = 100) None
Send email to any number of users, via bcc. Batches into groups of 100 recipients.
- Parameters:
subject – The subject of the email.
body – The body of the email.
recipients – Email addresses of all desired recipients.
png_attachment – Path to a
.pngfile to attach, if desired.batch_size – The number of recipients to include in each email batch.