leaguemanager.lib.email¶
Email service for sending transactional emails using SMTP.
Module Contents¶
Classes¶
Service for sending emails via SMTP. |
Functions¶
Decorator to run async functions in sync context. |
Data¶
API¶
- leaguemanager.lib.email.logger¶
‘getLogger(…)’
- leaguemanager.lib.email.async_to_sync(func: Any) Any¶
Decorator to run async functions in sync context.
- class leaguemanager.lib.email.EmailService¶
Service for sending emails via SMTP.
Initialization
Initialize email service with settings.
- _create_smtp_connection() smtplib.SMTP | smtplib.SMTP_SSL | None¶
Create SMTP connection based on settings.
Returns: SMTP connection or None if email is disabled
- async send_email(to_email: str | list[str], subject: str, html_content: str, text_content: str | None = None, from_email: str | None = None, from_name: str | None = None, reply_to: str | None = None) bool¶
Send email with HTML and optional text content.
Args: to_email: Recipient email address(es) subject: Email subject html_content: HTML email content text_content: Plain text content (optional, generated from HTML if not provided) from_email: Sender email (uses default if not provided) from_name: Sender name (uses default if not provided) reply_to: Reply-to email address (optional)
Returns: True if email was sent successfully, False otherwise
- async send_template_email(template_name: str, to_email: str | list[str], subject: str, context: dict[str, Any], from_email: str | None = None, from_name: str | None = None) bool¶
Send email using a template.
Args: template_name: Name of template file (without extension) to_email: Recipient email address(es) subject: Email subject context: Template context variables from_email: Sender email (uses default if not provided) from_name: Sender name (uses default if not provided)
Returns: True if email was sent successfully, False otherwise
- async send_verification_email(user: leaguemanager.models.User, verification_token: leaguemanager.models.EmailVerificationToken) bool¶
Send email verification email to user.
Args: user: The user to send the email to verification_token: The verification token
Returns: True if email was sent successfully
- async send_welcome_email(user: leaguemanager.models.User) bool¶
Send welcome email to newly verified user.
Args: user: The user to send the welcome email to
Returns: True if email was sent successfully
- async send_password_reset_email(user: leaguemanager.models.User, reset_token: leaguemanager.models.PasswordResetToken, expires_in_minutes: int = 60, ip_address: str = 'unknown') bool¶
Send password reset email to user.
Args: user: The user to send the email to reset_token: The password reset token expires_in_minutes: How long the token is valid for ip_address: IP address where reset was requested
Returns: True if email was sent successfully
- async send_password_reset_confirmation_email(user: leaguemanager.models.User, reset_time: datetime.datetime | None = None) bool¶
Send password reset confirmation email to user.
Args: user: The user whose password was reset reset_time: When the password was reset (defaults to now)
Returns: True if email was sent successfully
- async send_team_invitation_email(invitee_email: str, inviter_name: str, team_name: str, invitation_url: str) bool¶
Send team invitation email.
Args: invitee_email: Email address to send invitation to inviter_name: Name of person sending invitation team_name: Name of the team invitation_url: URL to accept the invitation
Returns: True if email was sent successfully
- leaguemanager.lib.email.email_service¶
‘EmailService(…)’