Chinaunix首页 | 论坛 | 博客
  • 博客访问: 465255
  • 博文数量: 122
  • 博客积分: 1403
  • 博客等级: 中尉
  • 技术积分: 1668
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-11 13:31
文章分类

全部博文(122)

文章存档

2018年(5)

2017年(12)

2014年(15)

2013年(33)

2012年(4)

2011年(53)

分类: LINUX

2013-06-26 19:31:49

0,使用Net::SMTP_auth发邮件,首先要先安装Net::SMTP_auth ,Digest::HMAC_MD5模块安装
               
1,安装Perl模块Module::Build

                # wget
                # tar xvf Module-Build-0.36_11.tar.gz 
                # cd Module-Build-0.36_11
                # perl Build.PL 
                # ./Build 
                # ./Build test
                # ./Build install
                # cd ..

        2,安装Perl模块Authen::SASL
                # wget
                # tar xvf Authen-SASL-2.15.tar.gz 
                # cd Authen-SASL-2.15
                # perl Makefile.PL 
                # make test
                # make install
                # cd ..

        3,安装Perl模块Net::SMTP_auth
                # wget
                # tar xvf Net-SMTP_auth-0.08.tar.gz 
                # cd Net-SMTP_auth-0.08
                # perl Makefile.PL 
                # make test
                # make install
                # cd ..

        4,安装Perl模块SVN::Notify
                # wget
                # tar xvf SVN-Notify-2.80.tar.gz 
                # cd SVN-Notify-2.80
                # perl Build.PL 
                # ./Build 
                # ./Build test
                # ./Build install
                # cd ..

        5,启动邮件服务器
                # service sendmail restart
                Shutting down sendmail:                                    [FAILED]
                Starting sendmail:                                         [  OK  ]
                Starting sm-client:                                        [  OK  ]

        6,配置自动发邮件脚本
                修改post-commit脚本,以支持邮件通知功能.
                # cd /home/svn/project/hooks/
                # vim post-commit
                内容如下:
                #!/bin/sh
                REPOS="$1"
                REV="$2"
                
                /usr/local/bin/svnnotify --repos-path "$1" --revision "$2"  --to  user1@gvtv.com.cn  --to  user2@gvtv.com.cn  --from gvtv_svnadmin@163.com --handler "HTML::ColorDiff"  --with-diff --smtp localhost --smtp-user root --smtp-pass 5201314318 -c "UTF-8" -g zh_CN -o raw --svnlook /usr/bin/svnlook --subject-prefix '[SVN Update]'
                (to参数代表接收邮件的地址,可以有多个,格式为 --to maiil1 --to mail2)。from参数是虚拟的,代表你的发送地址,一般情况下,这个参数不重要,但如果接收者的邮件服务器有反垃圾邮件的功能,需要判定源地址的话,这个参数是否合法就显得很重要了)
                再给该脚本添加可执行权限
                # chmod +x post-commit

        7,再次提交时,就会给指定邮件地址发信了。
阅读(884) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~