Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7493329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:53:48+00:00 2026-05-29T16:53:48+00:00

I am using standard SMTPHandler logger to catch my Python exceptions. Is there a

  • 0

I am using standard SMTPHandler logger to catch my Python exceptions. Is there a way how to put exception name into the subject of the mail? It would be much better than with static subject, because Gmail (and not only Gmail) can group conversations according to subject and so it could group it according to the type of error.

E.g., if 50 completely the same errors occure + 1 different, I’d see two conversations in my inbox instead of 1 group consisting 51 emails, where I can very easily overlook the single different one.

Also, is there a way how to prevent sending still the same errors? E. g. somehow define my own function deciding if email is to be sent or not. The function would take some basic info in params so it could decide (e.g. cache & see if such an issue was already sent).

I browsed the docs, but I can’t find anything like that. It seems to be very simple. If SMTPHandler can’t do this, what would be the best and still simple alternative? Any neat libraries?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:53:53+00:00Added an answer on May 29, 2026 at 4:53 pm

    You simply need to create your own subclass of SMTPHandler.

    For your first request: You just need to override the getSubject(record) method. As to what you can put in the subject, look at help(Formatter) after importing Formatter from logging.

    For your second request: You must override the emit(record) method. Inspect the record and make your own decision about whether it should be send. If so then just call the super(SMTPHandler,self).emit(record) method.

    class MySMTPHandler(SMTPHandler):
    
        def getSubject(self, record):
            return "My Error Format from the record dict"
    
        def emit(self, record):
            #check for record in self.already_send or something
            if sendit:
               super(MySMTPHandler,self).emit(record)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using standard mysql functions is there a way to write a query that will
I wrote a program in python (using standard python libraries) long ago. Now I
I have an iPhone application that is mostly using standard controls. There is one
I have a seam component where I put a message using standard seam annotation:
I need to create a diff file using standard UNIX diff command with python
I am using standard 3G connection for video streaming. Streaming Media application works fine.
I'm using standard Delphi constants DayMonday, etc and I want to convert them to
I am using standard windows forms controls under C#. I have two controls which
In my ASP MVC application I'm using standard SQL (rather that Linq to SQL
Let me clarify: I'm using standard jQuery autocomplete plugin (bassistanse.de) and bind it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.