Changeset 149


Ignore:
Timestamp:
03/08/07 22:53:07 (17 years ago)
Author:
jouvin
Message:

EmailToTracScript?
EmailtoTracScript?:

Blacklist (don't register as ticket ) mail from MAILER-DAEMON

Location:
emailtotracscript/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • emailtotracscript/trunk/ChangeLog

    r146 r149  
     12007-03-08 Michel Jouvin <jouvin@lal.in2p3.fr>
     2        * email2trac.py : blacklist (don't create ticket) mail from
     3          MAILER-DAEMON to avoid loops
     4        * msg.bad.txt : add an example of message from MAILER-DAEMON
     5
     6
    172006-12-08
    28        * email2trac.py:
  • emailtotracscript/trunk/email2trac.py.in

    r148 r149  
    202202                return self.get_config('ticket', 'default_component')
    203203
     204        def blacklisted_from(self):
     205                FROM_RE = re.compile(r"""
     206                    MAILER-DAEMON@
     207                    """, re.VERBOSE)
     208                result =  FROM_RE.search(self.email_addr)
     209                if result:
     210                        return True
     211                else:
     212                        return False
     213
    204214        def email_to_unicode(self, message_str):
    205215                """
     
    443453                #
    444454                if self.DROP_SPAM and (tkt['component'] == 'Spam'):
    445                         # print 'This message is a SPAM. Automatic ticket insertion refused (SPAM level > %d' % self.SPAM_LEVEL
     455                        if self.DROP_SPAM > 2 :
     456                          print 'This message is a SPAM. Automatic ticket insertion refused (SPAM level > %d' % self.SPAM_LEVEL
    446457                        return False   
    447458
     
    510521
    511522                self.db = self.env.get_db_cnx()
    512                 self.get_author_emailaddrs(m)
     523                self.get_author_emailaddrs(m)
     524                if self.blacklisted_from():
     525                        if self.DEBUG > 1 :
     526                                print 'Message rejected : From: in blacklist'
     527                        return False
    513528
    514529                if self.get_config('notification', 'smtp_enabled') in ['true']:
Note: See TracChangeset for help on using the changeset viewer.