dev.heartsavior.net/45

Trac 메일 발송이 되지 않을 때 - SMTPAuthenticationError: (535, 'authorization failed (#5.7.0)')



메일 호스팅을 옮기면서 Trac의 알림 메일이 보내지지 않는 상황이 발생했다.

일단 log 파일을 열어 상황을 보니...
SMTPAuthenticationError: (535, 'authorization failed (#5.7.0)')

라는 에러 메시지가 보였다.

파이썬을 전혀 모르기 때문에 구글링을 시작했고,
@ [Trac] How to fix an SMTP authentication issue

라는 페이지에서 해답을 찾아 해결할 수 있었다.

아래는 페이지 내용...
I'm posting this to help anyone who might have the same problem. I wasgetting this in the log whenever Trac tried to send an email: (535, 'authorization failed (#5.7.0)')

After searching around google regarding the python smtplib, I was able to fix the problem. In the smtplib.py python source file, I found the following line in the login method:
preferred_auths = [AUTH_CRAM_MD5, AUTH_PLAIN, AUTH_LOGIN]

I changed the line to use the AUTH_LOGIN method and now I can sendemails ok:
preferred_auths = [AUTH_LOGIN, AUTH_PLAIN]

I guess my smtp server (a very large commercial provider) doesn't like the CRAM_MD5 method. This is the only python app I have running on myserver, so I wasn't concerned with it affecting another app.

- Brian

ps. smtplib.py는 PYTHON_설치경로\Lib 에 있고, py 파일 수정 후 pyc 파일을 삭제하면 필요시에 자동 컴파일되어 pyc 파일이 생성된다.

Posted by [czar]
,