我在 debian lenny 上,trac 0.11(apt-get install trac 的默认设置)
我使用 gmail 设置了票证通知,有时它们可以工作,有时我会收到严重错误,并且对于一个用户它只起作用过一次。我的所有用户都有一个 gmail 帐户。
有时我会收到这个错误:
2010-09-28 16:35:31,708 Trac[web_ui] ERROR: Failure sending
notification on creation of ticket #15: (-2, 'Name or service not
known')
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/trac/ticket/web_ui.py", line
962, in _do_create
tn.notify(ticket, newticket=True)
File "/usr/lib/python2.5/site-packages/trac/ticket/notification.py",
line 148, in notify
NotifyEmail.notify(self, ticket.id, subject)
File "/usr/lib/python2.5/site-packages/trac/notification.py", line
246, in notify
Notify.notify(self, resid)
File "/usr/lib/python2.5/site-packages/trac/notification.py", line
134, in notify
self.begin_send()
File "/usr/lib/python2.5/site-packages/trac/notification.py", line
318, in begin_send
self.server = smtplib.SMTP(self.smtp_server, self.smtp_port)
File "/usr/lib/python2.5/smtplib.py", line 244, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.5/smtplib.py", line 296, in connect
for res in socket.getaddrinfo(host, port, 0,
socket.SOCK_STREAM):
有时我会收到一些用户的邮件,但总会遗漏一封:
2010-09-28 16:49:51,519 Trac[notification] INFO: Sending SMTP
notification to smtp.gmail.com:587 to [u'[email protected]',
u'[email protected]']
有时一切正常!
有时我会收到警告:
2010-09-28 15:53:55,932 Trac[notification] WARNING: Slow mail
submission (5.07 s), check your mail setup
2
这是 trac.ini 通知部分:
[notification]
admit_domains =
always_notify_owner = false
always_notify_reporter = false
always_notify_updater = true
ignore_domains =
mime_encoding = base64
smtp_always_bcc = true
smtp_always_cc = true
smtp_default_domain =
smtp_enabled = true
smtp_from = [email protected]
smtp_from_name = Trac Catwizard
smtp_password = passwd
smtp_port = 587
smtp_replyto = [email protected]
smtp_server = smtp.gmail.com
smtp_subject_prefix = __default__
smtp_user = [email protected]
ticket_subject_template = $prefix #$ticket.id: $summary
use_public_cc = false
use_short_addr = false
use_tls = true
在我能够设置好之后,我能够在
Debian 上配置 exim 以使用 gmail,也许通过 exim 发送邮件更好?
但是在 trac.ini 中如何配置呢?
请帮忙!
谢谢!
答案1
好吧,如果您已成功配置 exim 通过 gmail 发送,那么这就是要走的路。通过这样做,您将让 trac 将邮件交给知道如何可靠地传递邮件(排队、重试等)的“真实”MTA。
我假设您有 exim 在监听 localhost (127.0.0.1) 端口 25。如果是这种情况,则只需在 trac.ini 中设置以下内容:
smtp_always_bcc = true
smtp_always_cc = true
smtp_default_domain =
smtp_enabled = true
smtp_from = [email protected]
smtp_from_name = Trac Catwizard
smtp_password =
smtp_port = 25
smtp_replyto = [email protected]
smtp_server = localhost
smtp_subject_prefix = default
smtp_user =
答案2
您可以在 trac 网站上找到有关使用其他帐户设置电子邮件发送的更多信息: http://trac.edgewall.org/wiki/TracNotification#ExampleConfigurationSMTP
另外,您可以在上述同一页面上验证您的 Gmail 配置。