Show More
@@ -26,8 +26,6 b' debug = true' | |||
|
26 | 26 | #smtp_port = |
|
27 | 27 | #smtp_use_tls = false |
|
28 | 28 | #smtp_use_ssl = true |
|
29 | ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.) | |
|
30 | #smtp_auth = | |
|
31 | 29 | |
|
32 | 30 | [server:main] |
|
33 | 31 | ## COMMON ## |
@@ -26,8 +26,6 b' debug = true' | |||
|
26 | 26 | #smtp_port = |
|
27 | 27 | #smtp_use_tls = false |
|
28 | 28 | #smtp_use_ssl = true |
|
29 | ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.) | |
|
30 | #smtp_auth = | |
|
31 | 29 | |
|
32 | 30 | [server:main] |
|
33 | 31 | ## COMMON ## |
@@ -19,9 +19,7 b' Once configured you can check the settin' | |||
|
19 | 19 | ## Additionally these settings will be used by the RhodeCode mailing system ## |
|
20 | 20 | ################################################################################ |
|
21 | 21 | #email_to = admin@localhost |
|
22 | #error_email_from = paste_error@localhost | |
|
23 | 22 | #app_email_from = rhodecode-noreply@localhost |
|
24 | #error_message = | |
|
25 | 23 | #email_prefix = [RhodeCode] |
|
26 | 24 | |
|
27 | 25 | #smtp_server = mail.server.com |
@@ -30,5 +28,3 b' Once configured you can check the settin' | |||
|
30 | 28 | #smtp_port = |
|
31 | 29 | #smtp_use_tls = false |
|
32 | 30 | #smtp_use_ssl = true |
|
33 | ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.) | |
|
34 | #smtp_auth = |
@@ -1368,6 +1368,22 b' self: super: {' | |||
|
1368 | 1368 | license = [ { fullName = "Repoze Public License"; } { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ]; |
|
1369 | 1369 | }; |
|
1370 | 1370 | }; |
|
1371 | "pyramid-mailer" = super.buildPythonPackage { | |
|
1372 | name = "pyramid-mailer-0.15.1"; | |
|
1373 | doCheck = false; | |
|
1374 | propagatedBuildInputs = [ | |
|
1375 | self."pyramid" | |
|
1376 | self."repoze.sendmail" | |
|
1377 | self."transaction" | |
|
1378 | ]; | |
|
1379 | src = fetchurl { | |
|
1380 | url = "https://files.pythonhosted.org/packages/a0/f2/6febf5459dff4d7e653314d575469ad2e11b9d2af2c3606360e1c67202f2/pyramid_mailer-0.15.1.tar.gz"; | |
|
1381 | sha256 = "16vg8jb203jgb7b0hd6wllfqvp542qh2ry1gjai2m6qpv5agy2pc"; | |
|
1382 | }; | |
|
1383 | meta = { | |
|
1384 | license = [ pkgs.lib.licenses.bsdOriginal ]; | |
|
1385 | }; | |
|
1386 | }; | |
|
1371 | 1387 | "pyramid-mako" = super.buildPythonPackage { |
|
1372 | 1388 | name = "pyramid-mako-1.0.2"; |
|
1373 | 1389 | doCheck = false; |
@@ -1596,6 +1612,22 b' self: super: {' | |||
|
1596 | 1612 | license = [ { fullName = "Repoze Public License"; } { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ]; |
|
1597 | 1613 | }; |
|
1598 | 1614 | }; |
|
1615 | "repoze.sendmail" = super.buildPythonPackage { | |
|
1616 | name = "repoze.sendmail-4.4.1"; | |
|
1617 | doCheck = false; | |
|
1618 | propagatedBuildInputs = [ | |
|
1619 | self."setuptools" | |
|
1620 | self."zope.interface" | |
|
1621 | self."transaction" | |
|
1622 | ]; | |
|
1623 | src = fetchurl { | |
|
1624 | url = "https://files.pythonhosted.org/packages/12/4e/8ef1fd5c42765d712427b9c391419a77bd48877886d2cbc5e9f23c8cad9b/repoze.sendmail-4.4.1.tar.gz"; | |
|
1625 | sha256 = "096ln02jr2afk7ab9j2czxqv2ryqq7m86ah572nqplx52iws73ks"; | |
|
1626 | }; | |
|
1627 | meta = { | |
|
1628 | license = [ pkgs.lib.licenses.zpl21 ]; | |
|
1629 | }; | |
|
1630 | }; | |
|
1599 | 1631 | "requests" = super.buildPythonPackage { |
|
1600 | 1632 | name = "requests-2.9.1"; |
|
1601 | 1633 | doCheck = false; |
@@ -1685,6 +1717,7 b' self: super: {' | |||
|
1685 | 1717 | self."pyramid-jinja2" |
|
1686 | 1718 | self."pyramid-mako" |
|
1687 | 1719 | self."pyramid" |
|
1720 | self."pyramid-mailer" | |
|
1688 | 1721 | self."pysqlite" |
|
1689 | 1722 | self."python-dateutil" |
|
1690 | 1723 | self."python-ldap" |
@@ -1970,6 +2003,20 b' self: super: {' | |||
|
1970 | 2003 | license = [ pkgs.lib.licenses.bsdOriginal ]; |
|
1971 | 2004 | }; |
|
1972 | 2005 | }; |
|
2006 | "transaction" = super.buildPythonPackage { | |
|
2007 | name = "transaction-2.2.1"; | |
|
2008 | doCheck = false; | |
|
2009 | propagatedBuildInputs = [ | |
|
2010 | self."zope.interface" | |
|
2011 | ]; | |
|
2012 | src = fetchurl { | |
|
2013 | url = "https://files.pythonhosted.org/packages/a6/5e/09da91cb9373c73aae41721e5571c47db72fa9e11b259ca8fd3b01e306e9/transaction-2.2.1.tar.gz"; | |
|
2014 | sha256 = "0ykcfx5mw76z8wwg6a68ahr52q3qa75hky1xx9axbr9pwiq2097j"; | |
|
2015 | }; | |
|
2016 | meta = { | |
|
2017 | license = [ pkgs.lib.licenses.zpl21 ]; | |
|
2018 | }; | |
|
2019 | }; | |
|
1973 | 2020 | "translationstring" = super.buildPythonPackage { |
|
1974 | 2021 | name = "translationstring-1.3"; |
|
1975 | 2022 | doCheck = false; |
@@ -61,6 +61,7 b' pyramid-debugtoolbar==4.4.0' | |||
|
61 | 61 | pyramid-jinja2==2.7 |
|
62 | 62 | pyramid-mako==1.0.2 |
|
63 | 63 | pyramid==1.9.2 |
|
64 | pyramid_mailer==0.15.1 | |
|
64 | 65 | pysqlite==2.8.3 |
|
65 | 66 | python-dateutil |
|
66 | 67 | python-ldap==3.1.0 |
@@ -26,11 +26,13 b' by celery daemon' | |||
|
26 | 26 | import os |
|
27 | 27 | import time |
|
28 | 28 | |
|
29 | from pyramid_mailer.mailer import Mailer | |
|
30 | from pyramid_mailer.message import Message | |
|
31 | ||
|
29 | 32 | import rhodecode |
|
30 | 33 | from rhodecode.lib import audit_logger |
|
31 | 34 | from rhodecode.lib.celerylib import get_logger, async_task, RequestContextTask |
|
32 | 35 | from rhodecode.lib.hooks_base import log_create_repository |
|
33 | from rhodecode.lib.rcmail.smtp_mailer import SmtpMailer | |
|
34 | 36 | from rhodecode.lib.utils2 import safe_int, str2bool |
|
35 | 37 | from rhodecode.model.db import Session, IntegrityError, Repository, User, true |
|
36 | 38 | |
@@ -58,7 +60,11 b' def send_email(recipients, subject, body' | |||
|
58 | 60 | return False |
|
59 | 61 | |
|
60 | 62 | subject = "%s %s" % (email_config.get('email_prefix', ''), subject) |
|
61 | if not recipients: | |
|
63 | ||
|
64 | if recipients: | |
|
65 | if isinstance(recipients, basestring): | |
|
66 | recipients = recipients.split(',') | |
|
67 | else: | |
|
62 | 68 | # if recipients are not defined we send to email_config + all admins |
|
63 | 69 | admins = [] |
|
64 | 70 | for u in User.query().filter(User.admin == true()).all(): |
@@ -70,19 +76,44 b' def send_email(recipients, subject, body' | |||
|
70 | 76 | recipients += [config_email] |
|
71 | 77 | recipients += admins |
|
72 | 78 | |
|
73 | mail_from = email_config.get('app_email_from', 'RhodeCode') | |
|
74 | user = email_config.get('smtp_username') | |
|
75 | passwd = email_config.get('smtp_password') | |
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 | debug = str2bool(email_config.get('debug')) | |
|
80 |
|
|
|
79 | # translate our LEGACY config into the one that pyramid_mailer supports | |
|
80 | email_conf = dict( | |
|
81 | host=mail_server, | |
|
82 | port=email_config.get('smtp_port'), | |
|
83 | username=email_config.get('smtp_username'), | |
|
84 | password=email_config.get('smtp_password'), | |
|
85 | ||
|
86 | tls=str2bool(email_config.get('smtp_use_tls')), | |
|
87 | ssl=str2bool(email_config.get('smtp_use_ssl')), | |
|
88 | ||
|
89 | # SSL key file | |
|
90 | # keyfile='', | |
|
91 | ||
|
92 | # SSL certificate file | |
|
93 | # certfile='', | |
|
94 | ||
|
95 | # Location of maildir | |
|
96 | # queue_path='', | |
|
97 | ||
|
98 | default_sender=email_config.get('app_email_from', 'RhodeCode'), | |
|
99 | ||
|
100 | debug=str2bool(email_config.get('smtp_debug')), | |
|
101 | # /usr/sbin/sendmail Sendmail executable | |
|
102 | # sendmail_app='', | |
|
103 | ||
|
104 | # {sendmail_app} -t -i -f {sender} Template for sendmail execution | |
|
105 | # sendmail_template='', | |
|
106 | ) | |
|
81 | 107 | |
|
82 | 108 | try: |
|
83 | m = SmtpMailer(mail_from, user, passwd, mail_server, smtp_auth, | |
|
84 | mail_port, ssl, tls, debug=debug) | |
|
85 | m.send(recipients, subject, body, html_body) | |
|
109 | mailer = Mailer(**email_conf) | |
|
110 | ||
|
111 | message = Message(subject=subject, | |
|
112 | sender=email_conf['default_sender'], | |
|
113 | recipients=recipients, | |
|
114 | body=body, html=html_body) | |
|
115 | mailer.send_immediately(message) | |
|
116 | ||
|
86 | 117 | except Exception: |
|
87 | 118 | log.exception('Mail sending failed') |
|
88 | 119 | return False |
@@ -6,9 +6,7 b'' | |||
|
6 | 6 | <% |
|
7 | 7 | elems = [ |
|
8 | 8 | (_('Email prefix'), c.rhodecode_ini.get('email_prefix'), ''), |
|
9 |
(_(' |
|
|
10 | (_('Error email from'), c.rhodecode_ini.get('error_email_from'), ''), | |
|
11 | (_('Error email recipients'), c.rhodecode_ini.get('email_to'), ''), | |
|
9 | (_('Email from'), c.rhodecode_ini.get('app_email_from'), ''), | |
|
12 | 10 | |
|
13 | 11 | (_('SMTP server'), c.rhodecode_ini.get('smtp_server'), ''), |
|
14 | 12 | (_('SMTP username'), c.rhodecode_ini.get('smtp_username'), ''), |
@@ -17,7 +15,7 b'' | |||
|
17 | 15 | |
|
18 | 16 | (_('SMTP use TLS'), c.rhodecode_ini.get('smtp_use_tls'), ''), |
|
19 | 17 | (_('SMTP use SSL'), c.rhodecode_ini.get('smtp_use_ssl'), ''), |
|
20 | (_('SMTP auth'), c.rhodecode_ini.get('smtp_auth'), ''), | |
|
18 | ||
|
21 | 19 | ] |
|
22 | 20 | %> |
|
23 | 21 | <dl class="dl-horizontal settings"> |
@@ -54,7 +52,3 b'' | |||
|
54 | 52 | ${h.end_form()} |
|
55 | 53 | </div> |
|
56 | 54 | </div> |
|
57 | ||
|
58 | ||
|
59 | ||
|
60 |
@@ -25,21 +25,12 b' debug = true' | |||
|
25 | 25 | ## note: using appenlight for error handling doesn't need this to be uncommented |
|
26 | 26 | #email_to = admin@localhost |
|
27 | 27 | |
|
28 | ## in case of Application errors, sent an error email form | |
|
29 | #error_email_from = rhodecode_error@localhost | |
|
30 | ||
|
31 | ## additional error message to be send in case of server crash | |
|
32 | #error_message = | |
|
33 | ||
|
34 | ||
|
35 | 28 | #smtp_server = mail.server.com |
|
36 | 29 | #smtp_username = |
|
37 | 30 | #smtp_password = |
|
38 | 31 | #smtp_port = |
|
39 | 32 | #smtp_use_tls = false |
|
40 | 33 | #smtp_use_ssl = true |
|
41 | ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.) | |
|
42 | #smtp_auth = | |
|
43 | 34 | |
|
44 | 35 | [server:main] |
|
45 | 36 | ## COMMON ## |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now