Edgewall Software

Ticket #1018: trac.smtp.patch

File trac.smtp.patch, 3.2 KB (added by misc@…, 4 years ago)

Patch against trunk that implement this feature

  • wiki-default/TracIni

     
    4141== [notification] == 
    4242|| smtp_enabled   || Enable SMTP (email) notification (true, false) || 
    4343|| smtp_server    || SMTP server to use for email notifications || 
     44|| smtp_port      || Port used to contact smtp server in notication emails || 
    4445|| smtp_from      || Sender address to use in notification emails || 
    4546|| smtp_replyto   || Reply-To address to use in notification emails || 
    4647|| smtp_always_cc || Email address(es) to always send notifications to || 
  • wiki-default/TracNotification

     
    1818These are the available options for the ''[notification]'' section in trac.ini. 
    1919 * '''smtp_enabled''': Enable notification. 
    2020 * '''smtp_server''': SMTP server used for notification messages. 
     21 * '''smtp_port''': Port used to contact smtp server in notication emails. 
    2122 * '''smtp_from''': Email address to use for ''Sender''-headers in notification emails. 
    2223 * '''smtp_replyto''': Email address to use for ''Reply-To''-headers in notification emails. 
    2324 * '''smtp_always_cc''': List of email addresses to always send notifications to. ''Typically used to post ticket changes to a dedicated mailing list.'' 
  • trac/db_default.py

     
    438438  ('mimeviewer', 'enscript_path', 'enscript'), 
    439439  ('notification', 'smtp_enabled', 'false'), 
    440440  ('notification', 'smtp_server', 'localhost'), 
     441  ('notification', 'smtp_port', '25'), 
    441442  ('notification', 'smtp_user', ''), 
    442443  ('notification', 'smtp_password', ''), 
    443444  ('notification', 'smtp_always_cc', ''), 
  • trac/Notify.py

     
    7979    """Baseclass for notification by email.""" 
    8080 
    8181    smtp_server = 'localhost' 
     82    smtp_port = 25 
    8283    from_email = 'trac+tickets@localhost' 
    8384    subject = '' 
    8485    server = None 
     
    9293        self.smtp_server = self.env.get_config('notification', 
    9394                                               'smtp_server', 
    9495                                               self.smtp_server) 
     96        self.smtp_port = self.env.get_config('notification', 
     97                                             'smtp_port', 
     98                                              self.smtp_port) 
    9599        self.from_email = self.env.get_config('notification', 
    96100                                              'smtp_from', '') 
    97101        self.replyto_email = self.env.get_config('notification', 
     
    117121        return filter(lambda x: x.find('@') > -1, emails) 
    118122 
    119123    def begin_send(self): 
    120         self.server = smtplib.SMTP(self.smtp_server) 
     124        self.server = smtplib.SMTP(self.smtp_server,self.smtp_port) 
    121125        if self.user_name: 
    122126            self.server.login(self.user_name, self.password) 
    123127