SVN commit-email automatically send mail garbled problem resolution, and write your own svn sync mail script

Source: Internet
Author: User
Tags svn update shebang

Work is busy, these days the project collaborators have a request, is the Cooperative SVN warehouse submission can automatically notify all participants in the mail. This should be very mature. Google, found some of the most common ways. For example, using commit-email.pl, there is a bunch of articles on the Internet using commit-email.pl, and it is not repeated. Using Commit-email has garbled solution as follows

Using Commit-email, you need to add a sentence in the Post-commit

LANG=zh_CN.GB18030export LANG

This sentence can solve the log log when sending mail garbled problem, if you are other regional language, you can refer to similar ways to try to modify the resolution.

If the content of the modification is garbled, you can modify

push(@head, "Content-Type: text/plain; charset=UTF-8\n");

For

push(@head, "Content-Type: text/plain; charset=zh_CN.UTF-8\n");

I was through the above way to solve the garbled problem, the fatal is that the company's mailbox server directly intercepted my sendmail, all the mail all intercepted into the garbage classification. And the client cannot see it.

No way, only self-tinker.

SVN after completion, you can call the hook execution script, directly with the company's mailbox account name password will be able to resolve the sending interception asked.

A search after found the MSMTP + mutt, Linux under the command line client.

The specific implementation is as follows

Installing Mutt and MSMTP

sudo apt-get install muttsudo apt-get install msmtp

Finish loading the client

Then configure MSMTP, create MSMTPRC in/etc directory this is the configuration file

Write

default#你的smtp地址25#你的邮箱讯息from [email protected]auth logintls offuser xxxxpassword xxxx#自己修改日志路径logfile /home/svn/maillog

Then modify the mutt configuration file is generally/etc/muttrc, appended at the end

set sendmail="/usr/bin/msmtp"set use_from=yesset realname="[email protected]"set editor="vim"

At this point should be able to send mail, if not sure you are where the configuration is wrong.

Test mail Send

echo‘hello‘-s‘test‘ 你的邮箱

See if we can get the mail in the mailbox

Then there's the script.

My script is simple enough to say it can be used

Create a file under the hooks of the warehouse

touch mailNotifychmod +x mailNotifyvim mailNotify

Then add the following code, after this code is finished you can use directly./run to see, can run through should also be able to send mail

#!/bin/bash#用法 mailnotify SVN repository path SVN version number email address 1 email address 2 ...#这段是用来保证log中文的正确性的, you can make the appropriate changes according to your language .ExportLc_ctype="zh_cn.gb18030"#修改/usr/bin/svnlook to your actual svnlook pathSvnlook=/usr/bin/svnlook#修改mutt到你实际mutt的安装位置mutt=/usr/bin/muttcontext=$ ($SVNLOOKInfo $-R $)#打印svn的更新信息Shiftshift#将联系人串成一串儿Email= $Shift while(($#;0)) DoEmail=$email, $Shift Done#调用mutt发送邮件Echo $context|$MUTT - S ' SVN Update ' $email

The next step is to modify the Post-commit, the script is automatically called, it can automatically after the update call execution

cp post-commit.tmpl post-commitchmod +x post-commit

Then comment out the execution code inside, put it into our execution code, and take care not to comment out the repos and Rev two variables

Add these words

#mailNotify路径用绝对路径${REPOS${REV} xxx@xxx.com xxx@bbb.com

The back can be a lot more mailboxes, plus how much should be no problem.

Then you can try to update a version to see if there are any emails sent out.

This should be completed, there are questions can be put forward in the message.
You can also visit my blog website http://xifengzui.com

SVN commit-email automatically send mail garbled problem resolution, and write your own svn sync mail script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.