app.emails

Email sending utilities for the Mail List Shield application.

This module provides functions for sending various types of emails including password reset, email verification, and subscription notifications. All emails are sent asynchronously to avoid blocking the main thread.

Functions

send_email_to_reset_password(email)

Send an email with the password reset link.

send_email_with_code(user)

Send an email with the verification code.

send_email_about_subscription_confirmation(user,Β tier_name)

Send an email with the paid subscription confirmation.

send_email_about_subscription_cancellation(user,Β ...)

Send an email with the subscription cancellation information.

send_email_about_subscription_deletion(user,Β tier_name)

Send an email with the subscription deletion information.

send_async_email(msg,Β app)

Send an email asynchronously.

Module Contents

app.emails.send_email_to_reset_password(email)[source]

Send an email with the password reset link.

Parameters:

email – The email address of the user.

app.emails.send_email_with_code(user)[source]

Send an email with the verification code.

Implements rate limiting: only sends if at least 60 seconds have passed since the last email, and limits total emails to 5.

Parameters:

user – The user object from the database.

app.emails.send_email_about_subscription_confirmation(user, tier_name)[source]

Send an email with the paid subscription confirmation.

Parameters:
  • user – The user object from the database.

  • tier_name – The name of the subscription tier.

app.emails.send_email_about_subscription_cancellation(user, tier_name, cancellation_date)[source]

Send an email with the subscription cancellation information.

This is the email sent when the user cancels their subscription but the subscription is still active until the end of the billing period.

Parameters:
  • user – The user object from the database.

  • tier_name – The name of the subscription tier.

  • cancellation_date – The date of cancellation.

app.emails.send_email_about_subscription_deletion(user, tier_name)[source]

Send an email with the subscription deletion information.

This is the email sent when the subscription has ended.

Parameters:
  • user – The user object from the database.

  • tier_name – The name of the subscription tier.

app.emails.send_async_email(msg, app)[source]

Send an email asynchronously.

Parameters:
  • msg – The Message object containing email details.

  • app – The Flask application instance.