From 10e9b157c009543839f09184c75b6b2420607b96 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: May 27 2015 13:22:00 +0000 Subject: Make email sending optional Signed-off-by: Patrick Uiterwijk --- diff --git a/pagure/default_config.py b/pagure/default_config.py index e576b4c..2ffc41f 100644 --- a/pagure/default_config.py +++ b/pagure/default_config.py @@ -24,6 +24,9 @@ DB_URL = 'sqlite:////var/tmp/pagure_dev.sqlite' # The FAS group in which the admin of pagure are ADMIN_GROUP = 'sysadmin-main' +# Whether or not to send emails +EMAIL_SEND = True + # The email address to which the flask.log will send the errors (tracebacks) EMAIL_ERROR = 'pingou@pingoured.fr' diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 425d584..beb7485 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -167,6 +167,17 @@ def send_email(text, subject, to_mail, if not to_mail: return + if not pagure.APP.config.get('EMAIL_SEND', True): + print '******EMAIL******' + print 'To: %s' % to_mail + print 'Subject: %s' % subject + print 'in_reply_to: %s' % in_reply_to + print 'mail_id: %s' % mail_id + print 'Contents:' + print text + print '*****/EMAIL******' + return + smtp = smtplib.SMTP(pagure.APP.config['SMTP_SERVER']) for mailto in to_mail.split(','): msg = MIMEText(text.encode('utf-8'), 'plain', 'utf-8')