Changeset 631
- Timestamp:
- 06/21/13 17:41:13 (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r630 r631 78 78 sender_email = None 79 79 80 # This is to for the function set_reply_to_fiedl 81 REPLY_TO_ADDRESS = None 82 83 84 80 85 class SaraDict(UserDict.UserDict): 81 86 def __init__(self, dictin = None): … … 222 227 self.trac_smtp_from = self.get_config('notification', 'smtp_from') 223 228 self.smtp_default_domain = self.get_config('notification', 'smtp_default_domain') 229 self.smtp_replyto = self.get_config('notification', 'smtp_replyto') 224 230 225 231 … … 1779 1785 self.logger.info('subject: %s' %repr(subject)) 1780 1786 1787 ## First try the new method and then fall back to old method 1788 # 1789 if not self.parse_delivered_to_field(m, subject, spam_msg): 1790 self.parse_subject_field(m, subject, spam_msg) 1791 1792 def parse_delivered_to_field(self, m, subject, spam_msg): 1793 """ 1794 """ 1795 self.logger.debug('function parse_delivered_to_field') 1796 1781 1797 ## Ticket id is in Delivered-To Field. Trac notify must send this 1782 # 1783 #try: 1784 # print self.parameters.project_name 1785 # print 'Delivered To', m['Delivered-To'] 1786 # print self.parameters.to_parse_address_delimiter 1787 # id = m['Delivered-To'].split(self.parameters.to_parse_address_delimiter)[1] 1788 # print id 1789 # id = id.split('@')[0] 1790 # print id 1791 # 1792 # except KeyError, detail: 1793 # pass 1794 1798 # eg: is+390@surfsara.nl 1799 try: 1800 1801 #print self.parameters.project_name 1802 self.logger.debug('Delivered To: %s' %m['Delivered-To']) 1803 1804 id = m['Delivered-To'] 1805 id = id.split(self.parameters.recipient_delimiter)[1] 1806 id = id.split('@')[0] 1807 1808 self.logger.debug('\t Found ticket id: %s' %id) 1809 1810 if not self.ticket_update(m, id, spam_msg): 1811 return False 1812 1813 except KeyError, detail: 1814 pass 1815 except IndexError, detail: 1816 pass 1817 1818 return False 1819 1820 def parse_subject_field(self, m, subject, spam_msg): 1821 """ 1822 """ 1823 self.logger.debug('function parse_subject_header') 1795 1824 1796 1825 ## [hic] #1529: Re: LRZ … … 1801 1830 |(?P<reply>(?P<id>[#][\d]+)(?P<fields>\?.*)?:) 1802 1831 ''' 1832 1803 1833 ## Check if FullBlogPlugin is installed 1804 1834 # … … 2395 2425 Email2TracNotification.Notify.notify = AlwaysNotifyReporter 2396 2426 2427 2428 if self.parameters.notification_replyto_rewrite: 2429 global REPLY_TO_ADDRESS 2430 dummy = self.smtp_replyto.split('@') 2431 2432 if len(dummy) > 1: 2433 REPLY_TO_ADDRESS = '%s+%s@%s' %(dummy[0], self.id, dummy[1]) 2434 else: 2435 REPLY_TO_ADDRESS = '%s+%s' %(dummy[0], self.id) 2436 2437 import trac.notification as Email2TracNotification 2438 Email2TracNotification.Notify.notify = set_reply_to_field 2439 2397 2440 if self.parameters.dry_run : 2398 2441 self.logger.info('DRY_RUN: self.notify(tkt, True) reporter = %s' %tkt['reporter']) … … 2453 2496 if not sender_email in torcpts: 2454 2497 torcpts.append(sender_email) 2498 2499 #self.replyto_email = "bas.van.der.vlies@gmail.com" 2500 2501 self.begin_send() 2502 self.send(torcpts, ccrcpts) 2503 self.finish_send() 2504 2505 def set_reply_to_field(self, resid): 2506 """ 2507 Copy of def notify() to manipulate recipents to always include reporter for the 2508 notification. 2509 """ 2510 print sender_email, resid, REPLY_TO_ADDRESS 2511 (torcpts, ccrcpts) = self.get_recipients(resid) 2512 2513 self.replyto_email = '%s' %(REPLY_TO_ADDRESS) 2514 print self.replyto_email 2455 2515 2456 2516 self.begin_send() -
trunk/msg.txt
r606 r631 1 From bas v@sara.nl Wed Mar 8 15:29:17 20061 From bas.vandervlies@surfsara.nl Wed Mar 8 15:29:17 2006 2 2 Return-Path: <basv@sara.nl> 3 3 X-Original-To: test@subtrac.sara.nl … … 28 28 Test1234 29 29 30 -- 31 ******************************************************************** 32 * * 33 * Bas van der Vlies e-mail: basv@sara.nl * 34 * SARA - Academic Computing Services phone: +31 20 592 8012 * 35 * Kruislaan 415 fax: +31 20 6683167 * 36 * 1098 SJ Amsterdam * 37 * * 38 ******************************************************************** 30 --- 31 As of 1 January 2013, SARA has a new name: SURFsara. 32 33 Bas van der Vlies 34 | Operations, Support & Development | SURFsara | Science Park 140 | 1098 XG Amsterdam 35 | T +31 (0) 20 592 30 00 | bas.vandervlies@surfsara.nl | www.surfsara.nl | 39 36 40 37 --------------070800080005060203060809
Note: See TracChangeset
for help on using the changeset viewer.