You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm having a problem with the MultiEmailHandler, that two emails are being sent. One valid email and one empty email. The empty email will still have the subject line, but the min_level_name and max_level_name will be set to "NOTSET".
I tried to manually flush or close the handler before the script ends, but that just makes it worse and causes even more empty emails.
To Reproduce
See below for testcase
One email will be valid, a second email will have a subject of "email test: NOTSET - NOTSET"
Expected behavior
A single email to be generated for the run of the script.
Email provider:
Email service: private
Application to view the email: not relevant
Environment (please complete the following information if relevant):
OS: Linux
Python version: 3.11
Red Mail version: 0.6.0
Additional context
Add any other context about the problem here.
#!/bin/python3""" test MultiEmailHandler """importlogging.handlersfromredmailimportMultiEmailHandler# Create a custom loggerLOG=logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
# Create email log handlerSMTP_SERVER="email.server"SENDER_EMAIL="sender.email.address@server"RECEIVER_EMAIL= ["receiver.email.address@server"]
SUBJECT="email test: {min_level_name} - {max_level_name}"E_HANDLER=MultiEmailHandler(capacity=1024, **{
'host': SMTP_SERVER,
'port': 0,
'sender': SENDER_EMAIL,
'subject': SUBJECT,
'receivers': RECEIVER_EMAIL,
'text': """Logging level: {% for record in records %} Level name: {{ record.levelname }} Message: {{ record.msg }} {% endfor %} """,
'html': """ <ul> {% for record in records %} <li>Level name: {{ record.levelname }}</li> <li>Message: {{ record.msg }}</li> {% endfor %} </ul> """}
)
E_HANDLER.setLevel(logging.INFO)
LOG.addHandler(E_HANDLER)
LOG.debug("Testing debug")
LOG.info("Testing info")
LOG.warning("Testing warning")
LOG.error("Testing error")
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm having a problem with the MultiEmailHandler, that two emails are being sent. One valid email and one empty email. The empty email will still have the subject line, but the min_level_name and max_level_name will be set to "NOTSET".
I tried to manually flush or close the handler before the script ends, but that just makes it worse and causes even more empty emails.
To Reproduce
See below for testcase
One email will be valid, a second email will have a subject of "email test: NOTSET - NOTSET"
Expected behavior
A single email to be generated for the run of the script.
Email provider:
Environment (please complete the following information if relevant):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: