AlertMailer#
- class AlertMailer(config_path: str)#
A class to send notification emails using Gmail’s SMTP service.
- Parameters:
- config_pathstr
Path to configuration file containing email credentials
- Attributes:
- sender_passwordstr
Password for the sender’s email account
- sender_emailstr
Sender’s email address
Notes
The configuration file should be in INI format with an [Email] section containing email_password and email_address fields.
- send_email(receiver_email: str, subject: str, body: str) None#
Send an email using SMTP.
- Parameters:
- receiver_emailstr
Recipient’s email address
- subjectstr
Subject line of the email
- bodystr
Body content of the email
- Raises:
- smtplib.SMTPAuthenticationError
If authentication with Gmail fails
- smtplib.SMTPException
If there’s an error sending the email
- send_error_message(receiver_email: str, exception: str, traceback: str) None#
Send an error notification email.
- Parameters:
- receiver_emailstr
Recipient’s email address
- exceptionstr
Exception message
- tracebackstr
Traceback details of the exception
Notes
The email will be formatted with a standard subject line “Error Notification” and will include both the exception message and traceback in the body.