Windows

windows용 sendemail(visualsvn)

Naan 2013. 1. 31. 20:23
반응형

visualsvn 설치 하면서

post-commit hook 을 이용해서 메일을 발송시키려 했다.

 set REPOS=%1 
 set REV=%2 

"E:\VisualSVN Server\bin\VisualSVNServerHooks.exe" ^
commit-notification "%1"  --no-diffs -r %2 ^
--from svn@test.com --to test2@test.com ^
--smtp-server mail.test.com ^
--smtp-user svn.test@test.com ^
--smtp-password xxxxxxxx ^

위와 같이 post-commit 에 추가 하면 메일이 잘 발송이 된다 하지만

발송 메일에 내용이 허접하다.

자세한 내용의 정보를 받아 볼수 없다.

 

그래서 찾은게 윈도우용 sendemail 이다.

 sendEmail-v156.zip

이 파일을 이용해서 메일 발송하면 여러 내용을 메일에 담을수 있다.

post-commit

SET REPOS=%1
SET REV=%2
SET SUBJECT=[SVN] -rev %REV% - %REPOS%

echo. >> D:\util\log\%REV%.txt
echo Date:  >> d:\util\log\%REV%.txt
"d:\VisualSVN\bin\svnlook.exe" date %REPOS% -r %REV% >> d:\util\log\%REV%.txt

echo. >> D:\util\log\%REV%.txt
echo Who:  >> d:\util\log\%REV%.txt
"d:\VisualSVN\bin\svnlook.exe" author %REPOS% -r %REV% >> d:\util\log\%REV%.txt

echo. >> D:\util\log\%REV%.txt
echo Comment:  >> d:\util\log\%REV%.txt
"d:\VisualSVN\bin\svnlook.exe" log %REPOS% -r %REV% >> d:\util\log\%REV%.txt

echo. >> d:\util\log\%REV%.txt
echo Changes:  >> d:\util\log\%REV%.txt
"d:\VisualSVN\bin\svnlook.exe" changed %REPOS% -r %REV% >> d:\util\log\%REV%.txt

d:\util\sendEmail\sendemail.exe -s mail.test.com -f  svn@test.com -t test@test.com -u "%SUBJECT%"  -o message-file=d:\util\log\%REV%.txt


del d:\util\log\%REV%.txt

 

pre-commit  commit 입력하라는 스크립트

pre-commit

set REPOS=%1 
set TXN=%2          

"d:\VisualSVN\bin\svnlook.exe" log %REPOS% -t %TXN% | findstr . > nul 
 if %errorlevel% gtr 0 (goto err) else exit 0 

 :err 
 echo. 1>&2 
 echo 코멘트를 입력하지 않았습니다. 1>&2 
 echo 변경내역에 대한 설명을 작성하고 다시 시도하십시오. 1>&2
 exit 1

 

반응형