Question

I have a buildbot setup running for a software project, and am trying to set up e-mail notifications like so:

from buildbot.status import mail
c['status'].append(mail.MailNotifier(fromaddr=BUILDBOT_EMAIL,
                                     mode=('failing'),
                                     extraRecipients=[NOTIFICATION_EMAIL],
                                     sendToInterestedUsers=False))

Where BUILDBOT_EMAIL is a string "buildbot@name-of-our-project.org", and NOTIFICATION_EMAIL is a string with the email where I want to get the notifications.

According to documentation, everything seems fine; I am not sending mail to interested users so no lookup argument is required. I'm only trying to send mail to an explicitly stated address in case any build is failing. I am basically doing this:

To get a simple one-message-per-build (say, for a mailing list), use the following form instead. This form does not send mail to individual developers (and thus does not need the lookup= argument, explained below), instead it only ever sends mail to the extra recipients named in the arguments:

mn = MailNotifier(fromaddr="buildbot@example.org",
                  sendToInterestedUsers=False,
                  extraRecipients=['listaddr@example.org'])

However, no e-mails are arriving even though I do have failing builds. What could be the cause?

Could there be a problem with the way I'm using fromaddr and simply using a buildbot@domain-name.org address as per examples? Should this address be registered in some way with our domain? Would it make a difference if I use buildbot@localhost instead?

Could the problem be caused by me not using relayhost? From the examples in the documentation it appears that this only needs to be set for authentication with the outbound -- not the inbound -- address.

Any help will be greatly appreciated.

Was it helpful?

Solution

Similar to what kfunk suggested, I started by looking at twistd.log. It contained the following:

2013-02-09 04:26:18+0000 [-] sending mail (868 bytes) to ['addr@example.com']
2013-02-09 04:26:18+0000 [-] Starting factory <twisted.mail.smtp.ESMTPSenderFactory instance at 0x31dc488>
2013-02-09 04:26:18+0000 [Uninitialized] SMTP Client retrying server. Retry: 5
2013-02-09 04:26:18+0000 [Uninitialized] SMTP Client retrying server. Retry: 4
2013-02-09 04:26:18+0000 [Uninitialized] SMTP Client retrying server. Retry: 3
2013-02-09 04:26:18+0000 [Uninitialized] SMTP Client retrying server. Retry: 2
2013-02-09 04:26:18+0000 [Uninitialized] SMTP Client retrying server. Retry: 1
2013-02-09 04:26:18+0000 [Uninitialized] Unhandled error in Deferred:
2013-02-09 04:26:18+0000 [Uninitialized] Unhandled Error
    Traceback (most recent call last):
    Failure: twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 111: Connection refused.

I tried to manually send an email from the machine's command line (using sendmail), but failed; it turned out that no SMTP server is up. The solution is to install and configure a mail transfer agent (for Ubuntu, the most common one seems to be Postfix so I installed that). There are many tutorials and manuals out there on how to install and configure Postfix so once I found that clue it was easy to go on.

There are many considerations on having your own SMTP server; for example finding a way to secure it against unauthorised access, otherwise it could be used by e.g. spammers. However, if you want to get e-mails from buildbot, you have to have an SMTP server so it's worth the effort to learn and configure it correctly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top