我有SVN在Ubuntu 11.04 32位上运行,现在需要使用我的GMAIL帐户进行每次提交的通知。通过GMAIL SMTP的SVN通知
我已经提交了一些东西,但实际上并没有收到他们的提交邮件。没有显示任何错误,并且我查看了整个日志,但还没有发现很多有用的信息。
我已阅读相当多的帖子关于此和编辑下面的文件,包括他们现在包含的内容。我试过使用sendmail和postfix,但没有与他们的运气,因此这就是为什么我使用谷歌的邮件服务器。如果有人能指出我朝着正确的方向或另一种方法,我将不胜感激。
我找到并使用的链接。
http://sadomovalex.blogspot.com/2009/12/use-gmail-smtp-server-for-post-commit.html
http://iffee.wordpress.com/2009/04/08/svn-commit-to-google-apps-email-notification/
-commit.tmpl后
REPOS="$1"
REV="$2"
/home/megaz/svn/repos/ya/hooks/mailer.py commit "$REPOS" \
"$REV" /home/megaz/svn/repos/ya/hooks/mailer.conf
mailer.conf
[general]
smtp_hostname = smtp.gmail.com:587
smtp_username = #mygmailaddress
smtp_password = #mygmailpassword
smtp_use_ssl = true
smtp_use_tls = 1
[defaults]
diff = /usr/bin/diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s
commit_subject_prefix = [SVN-Commit]
propchange_subject_prefix =
lock_subject_prefix =
unlock_subject_prefix =
from_addr = #my from address
to_addr = #my to address
reply_to = #my replyto address
generate_diffs = none
show_nonmatching_paths = yes
[maps]
mailer.py
class SMTPOutput(MailedOutput):
def start(self, group, params):
MailedOutput.start(self, group, params)
self.buffer = StringIO()
self.write = self.buffer.write
self.write(self.mail_headers(group, params))
def finish(self):
server = smtplib.SMTP(self.cfg.general.smtp_hostname)
# 2009-12-13 asadomov: add ssl configuration (e.g. for gmail smtp server)
if self.cfg.is_set('general.smtp_use_ssl') and self.cfg.general.smtp_use_ssl.lower() == "true":
server.ehlo()
server.starttls()
server.ehlo()
if self.cfg.is_set('general.smtp_username'):
server.login(self.cfg.general.smtp_username,
self.cfg.general.smtp_password)
server.sendmail(self.from_addr, self.to_addrs, self.buffer.getvalue())
server.quit()
请编辑您的帖子添加到底是什么问题,错误输出等等。另外,把你的“问题”作为一个问题来说是很好的。 – agf
我的歉意是,我没有收到mailer.conf中指定的邮件地址中的提交邮件。 – Unleashed
'mailer.py'似乎没有做任何事情,它只是一个类定义,或者你只发布文件的一部分?无论如何,试着让它在命令行中起作用。 – tripleee