- export LANG=zh_CN.UTF-8
- REPOS="$1"
- REV="$2"
- SVNLOOK="svnlook"
- SEND_DATE=`date`
- PROJECT_NAME=`echo $REPOS|sed 's//.*///'`
- URL="http://www.xxx.com/filedetails.php?repname=$PROJECT_NAME&path=/"
- AUTHOR=`$SVNLOOK author $REPOS -r $REV`
- COMMIT_DATE=`$SVNLOOK date $REPOS -r $REV`
- COMMIT_LOG=`$SVNLOOK log $REPOS -r $REV`
- COMMIT_FILE=`$SVNLOOK changed $REPOS -r $REV|
- awk '{ printf("<div>%s <a href='$URL%s' target='_blank'>%s</a></div>n",$2,$2,$2) }'`
- MAIL_SUBJECT="[tltproject]$PROJECT_NAME (版本: $REV, 时间: $COMMIT_DATE)"
- MAIL_MSG=`cat << EOF
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>$PROJECT_NAME日志记录</title>
- </head>
- <body>
- <div style="width:550px; margin:15px;">
- <div style="font-size:14px;">
- <div style="height:30px; line-height:30px; background-color:#008040; color:#FFF; font-weight:900; font-size:18px;">基本信息</div>
- <div style="margin-top:10px; line-height:25px;">
- <div><strong>项目名称:</strong>$PROJECT_NAME</div>
- <div><strong>版本号:</strong>$REV</div>
- <div><strong>提交者:</strong>$AUTHOR</div>
- <div><strong>提交时间:</strong>$COMMIT_DATE</div>
- </div>
- <div style="height:30px; line-height:30px; background-color:#4682B4; color:#FFF; font-weight:900; font-size:18px;">提交说明</div>
- <div style="margin-top:10px;">
- <div style="line-height:25px; font-size:14px;"><pre style="font-size:15px;">$COMMIT_LOG</pre></div>
- </div>
- <div style="height:30px; line-height:30px; background-color:#4682B4; color:#FFF; font-weight:900; font-size:18px;">文件清单</div>
- <div style="margin-top:10px;">
- <div style="line-height:20px; font-size:14px;"><pre style="font-size:15px;">$COMMIT_FILE</pre></div>
- </div>
- </div>
- <div style="color:red;border-top:1px solid #333333;">XXX技术部内部邮件(发送时间: $SEND_DATE)</div>
- </div>
- </body>
- </html>
- EOF`
- #echo $COMMIT_FILE
- echo $MAIL_MSG | mutt -s "$MAIL_SUBJECT" -e "set content_type=text/html" XXX@gmail.com -c XXX@163.com &
- exit 0
- #该片段来自于http://www.codesnippet.cn/detail/121020136365.html
来源: http://www.codesnippet.cn/detail/121020136365.html