Jenkins, ReviewBoard 등 개발 지원 도구를 최초 설치하고나서 알림 메일 설정한 후에 메일이 발송되지 않는 경우가 있다.
로그를 보면 대충 다음과 같다.
ReviewBoard의 경우:
root@cr:/var/log/review-board# tail -f reviewboard.log
2014-04-02 05:29:21,272 - ERROR - - Error sending e-mail notification with subject 'Review Request 25: test' on behalf of '"mr foo" <foo@bar.com>' to '"A team" <a@bar.com>,"mr foo" <foo@bar.com>': [Errno 111] Connection refused
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.11-py2.7.egg/reviewboard/notifications/email.py", line 244, in send_review_mail
message.send()
File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/mail/message.py", line 248, in send
return self.get_connection(fail_silently).send_messages([self])
File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/mail/backends/smtp.py", line 85, in send_messages
new_conn_created = self.open()
File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/mail/backends/smtp.py", line 48, in open
local_hostname=DNS_NAME.get_fqdn())
File "/usr/lib/python2.7/smtplib.py", line 249, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py", line 309, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket
return socket.create_connection((port, host), timeout)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 111] Connection refused
Jenkins의 경우:
......
Sending e-mails to: a@bar.com
ERROR: Could not connect to SMTP host: localhost, port: 25
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at hudson.tasks.MailSender.execute(MailSender.java:117)
at hudson.tasks.Mailer.perform(Mailer.java:137)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
at hudson.model.Run.execute(Run.java:1701)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:385)
at java.net.Socket.connect(Socket.java:546)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)
... 17 more
Finished: FAILURE
내 경우 fresh install한 ubuntu box에 mailutils package가 깔려있지 않아서 생긴 문제였다.
$ sudo apt-get install mailutils
happy hackin'