Bugzilla Email

= Bugzilla Email =

Bugzilla email setup looks complex, but actually simple. Following are instructions for both incoming and outgoing mails.

System
Modify:

Replace bugz@mydomain.com and secret by your own user and password to fetch bugzilla mails.

Bugzilla
Administration → Parameters → Email mail_delivery_method: Sendmail mailfrom: bugz@mydomain.com use_mailer_queue: off

Customization
This will make bugzilla send mails on behalf of the users, but allow reply to bugzilla account, modify:

If you are using gmail, there is a bug so in order to properly reply to bugs you update modify:

Outgoing
Modify a bug, you should receive update notification from your-self.

Reply, and you should see bugz@mydomain.com as TO.

Incoming
Send the following mail to bugz@mydomain.com:

You should see bug#1 updated with "Test 1 2 3" text.

Subversion Integration
The following simple script scans the commit message for bug#NNNN and sends bugzilla mail with change set information linking to viewvc to ease review.

{{Code|commit-bugzilla.sh|
 * 1) !/bin/sh
 * 2) Copyright 2010-2011 Alon Bar-Lev 
 * 3) Distributed under the terms of the GNU General Public License v2

common_dir { local COMMON local CANDIDATE local n

read COMMON while read CANDIDATE; do		n=0 while [ -n "${COMMON:$n}" -a "${COMMON:0:$n}" = "${CANDIDATE:0:$n}" ]; do			n=$(($n+1)) done COMMON="${COMMON:0:$n}" done echo "${COMMON}" | sed 's#/[^/]*$#/#' }

BASE="$(dirname "$0")" REPOS="$1" REV="$2"

DIR="$(svnlook dirs-changed "${REPOS}" -r "${REV}" | sort | common_dir)" MSG="$(svnlook log "${REPOS}" -r "${REV}")" FROM="$(svnlook author "${REPOS}" -r "${REV}")" TO="${TO:-bugz@mydomain.com}" VIEWVC="http://my.mydomain.com/viewvc"

TOP="$(echo "${MSG}" | head -n1)"

for BUG in $(echo "${MSG}" | grep -i -o 'bug#[0-9][0-9]*'); do

BUGID="$(echo "${BUG}" | sed 's/bug#//i')"

/usr/sbin/sendmail -B8BITMIME "${TO}" << __EOF__ Subject: Bugzilla update From: ${FROM} Content-type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

@bug_id = ${BUGID}

COMMIT
$(basename "${REPOS}")@${REV}:${DIR} ${FROM} ${VIEWVC}/$(basename "${REPOS}")/?view=revision&revision=${REV} Log: ${MSG} __EOF__

done }}

To use, go to your repository and create/update hooks/post-commit hook (don't forget to mark as executable): hooks/post-commit

Maintainer
Alon Bar-Lev