我已经花了很多时间。但我仍然被卡住了。
我运行Ubuntu 12.04。
我已经设置了SVN,它运行正常。现在我想在每次提交时发送漂亮的电子邮件,所以我安装了svnnotify并应用了--css-inlne补丁。 (post)。
安全性较低,我可以使用phpmailer发送电子邮件。
在google上花了好几个小时后,我问你。
我尝试了以下内容:
发表提交:
#!/bin/sh
REV=$2
REPO=$1
/usr/local/bin/trac-admin /var/www/trac/htdocs/share changeset added "svn" $REV
# email notifications for commits
/usr/bin/svnnotify --repos-path "$REPO" --revision "$REV" \
--smtp smtp.gmail.com \
--smtp-port 587 \
--smtp-user noreply@donbolli.ch \
--smtp-pass pass \
--smtp-tls \
--to receiver@gmail.com \
--from noreply@donbolli.ch \
--with-diff \
--subject-cx \
--subject-prefix 'Share: ' \
--handler HTML::ColorDiff \
--css-inline
2>&1 &
exit 0
结果:
donbolli@luna585:~$ ./post-commit /var/www/svn/share 9
Couldn't start TLS: SSL connect attempt failed because of handshake problems error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
at /usr/share/perl5/SVN/Notify.pm line 2390.
所以我一直在寻找这个错误,但一无所获。
所以我尝试了另一种方法
发表提交:
#!/bin/sh
REV=$2
REPO=$1
/usr/local/bin/trac-admin /var/www/trac/htdocs/share changeset added "svn" $REV
# email notifications for commits
/usr/bin/svnnotify --repos-path "$REPO" --revision "$REV" \
--sendmail /home/donbolli/sendmail.py \
--to receiver@gmail.com \
--from noreply@donbolli.ch \
--with-diff \
--subject-cx \
--subject-prefix 'Share: ' \
--handler HTML::ColorDiff \
--css-inline
2>&1 &
exit 0
结果
donbolli@luna585:~$ ./post-commit /var/www/svn/share 9
Can't exec "/home/donbolli/sendmail.py": No such file or directory at /usr/share/perl5/SVN/Notify.pm line 2332.
Cannot exec /home/donbolli/sendmail.py: No such file or directory
但该文件存在(并且是755)
donbolli@luna585:~$ cat /home/donbolli/sendmail.py
#!/usr/bin/perl
use MIME::Lite;
use Net::SMTPS;
my $msg = MIME::Lite ->new (
From => 'noreply@donbolli.ch',
To => 'receiver@gmail.com',
Type => 'text/html; charset=UTF-8'
);
...
答案 0 :(得分:0)
我的提交后;
#!/bin/sh
REV=$2
REPO=$1
/usr/local/bin/trac-admin /var/www/trac/htdocs/share changeset added "svn" $REV
# email notifications for commits
/usr/bin/svnnotify --repos-path "$REPO" --revision "$REV" \
--sendmail /usr/sbin/sendmail \
--to recriver@gmail.com \
--from noreply@donbolli.ch \
--with-diff \
--subject-cx \
--subject-prefix 'Share: ' \
--handler HTML::ColorDiff \
--css-inline
2>&1 &
exit 0
在我遵循sendmail说明后工作。