Linux或Ubuntu下SVN服务器自动发送邮件配置

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Linux或Ubuntu下SVN服务器发送邮件配置1.下载commit-email.pl下载地址:下载脚本文件,保存为commit-email.pl。需要注意的是如果该文件是在windows下创建的,在拷贝到Ubuntu或Linux环境下需要转换格式,可使用dos2unix进行转换。2.安装Authen::SASL模块因为Perl通过SMTP发送邮件,其中SMTP验证的时候需要Authen::SASL模块。如果没安装此模块,则会提示如下错误:SMTPError:NeedMIME::Base64andAutuen::SASLtodoauth。Ubuntu下安装Authen::SASL模块:#sudoapt-getinstalllibauthen-sasl-perlRedhat下安装Authen::SASL模块:#wget修改commit-email.pl脚本:3.1.修改perl默认路径:#!/usr/bin/envperl改为#!/usr/bin/perl3.2.设置smtpserver,对于公共邮件服务器还需要设置用户名密码:my($sendmail,$smtp_server);改为my($sendmail,$smtp_server,$username,$passwd);$smtp_server=xxx.xxx.xxx;//邮件服务器的域名$username='xxx@xxx';//发送邮件用户$passwd=xxxxxx;//发送邮件密码my$smtp=Net::SMTP-new($smtp_server)ordie$0:erroropeningSMTPsessionto`$smtp_server':$!\n;代码之后添加如下一行:handle_smtp_error($smtp,$smtp-auth($username,$passwd));3.3.设置svnlook路径及svn代码比较参数my$svnlook=/usr/bin/svnlook;my$no_diff_deleted=1;my$no_diff_added=1;4.设置邮件标题及内容格式将commit-emai.pl文件保存到SVN版本库目录/svnroot下,在各个项目库的hooks目录post-commit文件里可运行此脚本。post-commit文件如下:#!/bin/shexportLANG=zh_CN.gb18030REPOS=$1REV=$2#邮件通知里不包含diff内容/svnroot/commit-email.pl$REPOS$REV--fromxxx@xxx.xxx.xxx-s邮件标题xxx@xxx.xxx.xxx#邮件通知包含diff内容#/svnroot/commit-email.pl$REPOS$REV--fromxxx@xxx.xxx.xxx-s邮件标题--diffyxxx@xxx.xxx.xxx6.设置完成,修改post-commit文件为可执行即可。

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功