$ sudo apt-get install subversion-tools
install SVN::Notify
perl -MCPAN -e 'install SVN::Notify'
$ sudo cp post-commit.tmpl post-commit $ sudo chown svnroot:svn post-commit $ sudo vim post-commit REPOS="$1" REV="$2" #/usr/share/subversion/hook-scripts/commit-email.pl "$REPOS" "$REV" openunix@163.com /usr/share/subversion/hook-scripts/commit-email.pl "$1" "$2" --from neo@netkiller.8800.org -h localhost -s "[SVN]" --diff y openunix@163.com openx@163.com
另一種方法
#!/bin/sh REPOS="$1" REV="$2" /usr/local/bin/svnnotify \ --repos-path "$REPOS" \ --revision "$REV" \ --subject-cx \ --with-diff \ --handler HTML::ColorDiff \ --to <your e-mail address> \ --from <from e-mail address>
/usr/bin/svnnotify --repos-path "$REPOS" --revision "$REV" \ --from neo@netkiller.8800.org --to openunix@163.com --smtp localhost \ --handler "HTML::ColorDiff" --with-diff --charset zh_CN:GB2312 -g zh_CN --svnlook /usr/bin/svnlook --subject-prefix '[SVN]'
如果你沒有安裝郵件伺服器,你可以使用服務商的SMTP如163.com
/usr/bin/svnnotify --repos-path "$REPOS" --revision "$REV" \ --from openx@163.com --to openunix@163.com --smtp smtp.163.com --smtp-user openunix --smtp-pass ****** \ --handler "HTML::ColorDiff" --with-diff --charset UTF-8 --language zh_CN --svnlook /usr/bin/svnlook --subject-prefix '[SVN]'
Charset
REPOS="$1" REV="$2" svnnotify --repos-path "$REPOS" --revision "$REV" \ --subject-cx \ --from neo.chen@example.com \ --to group@example.com,manager@example.com \ --with-diff \ --svnlook /usr/bin/svnlook \ --subject-prefix '[SVN]' \ --charset UTF-8 --language zh_CN