svn에서 hook을 통해 commit-post를 실행하면 희한하게 한글이 깨지네..
파이프쪽 로케일이 문제인가..
$ cat mailer.py #!/usr/bin/python # -*- coding:utf-8 -*- import smtplib import sys import os from email.mime.multipart import MIMEMultipart from email.MIMEText import MIMEText from subprocess import Popen, PIPE smtp_hostname="smtp.mailserver.com:port" smtp_username="mailer@mailserver.com" smtp_password="password" toaddrs = ['user1@mailserver.com','user2@mailserver.com','user2@mailserver.com'] project_name = os.path.basename(sys.argv[1]) subject = "["+project_name+"]"+" svn repository update required" content = project_name + "\n" + "rev : " + sys.argv[2]+ "\n" cmd_1 = ['svnlook','changed','-r',sys.argv[2],sys.argv[1]] proc = Popen(cmd_1, stdout=PIPE) difflist = proc.stdout.read() cmd_2 = ['svnlook','info','-r',sys.argv[2],sys.argv[1]] proc = Popen(cmd_2, stdout=PIPE) svninfo = proc.stdout.read() content = "[" + project_name + "]\n" + "rev : " + sys.argv[2]+ "\n" + difflist +"\n" + svninfo msg = MIMEMultipart() msg['From'] = smtp_username msg['To'] = ", ".join(toaddrs) msg['Subject'] = subject msg.attach(MIMEText(content,_charset='utf-8')) print msg.as_string() server = smtplib.SMTP_SSL(smtp_hostname) server.login(smtp_username,smtp_password) server.sendmail(smtp_username, toaddrs, msg.as_string()) server.quit() |
[링크 : http://stackoverflow.com/questions/10147455/how-to-send-an-email-with-gmail-as-provider-using-python]
[링크 : http://stackoverflow.com/.../python-subject-not-shown-when-sending-email-using-smtplib-module]
[링크 : http://blog.saltfactory.net/python/send-mail-via-smtp-and-python.html]
[링크 : http://ngee.tistory.com/159]
[링크 : http://www.janosgyerik.com/setup-and-test-svn-post-commit-hook-to-send-commit-log/]
[링크 : http://stackoverflow.com/questions/3925096/how-to-get-only-the-last-part-of-a-path-in-python]
[링크 : https://docs.python.org/2/library/email-examples.html]
[링크 : http://stackoverflow.com/questions/4537259/python-how-to-pipe-the-output-using-popen]
msg.attach(MIMEText(content,'plain',_charset="utf-8"))
[링크 : http://stackoverflow.com/questions/882712/sending-html-email-using-python]
[링크 : http://blog.saltfactory.net/python/send-mail-via-smtp-and-python.html]
'프로그램 사용 > Version Control' 카테고리의 다른 글
svn list 예제 (0) | 2017.02.03 |
---|---|
svn hook encv (0) | 2016.12.30 |
svn diff 결과물 컬러로 보기 (0) | 2016.12.30 |
svn commit시 email 알림 (0) | 2016.12.29 |
svn console에서 엔터 입력하기 (0) | 2016.11.08 |