Re: how to include database name in mails

Chad Walstrom <[email protected]> Mon, 18 Apr 2005 13:29:11 -0500
Newsgroups gmane.comp.bug-tracking.gnats.general
Message-ID <[email protected]>
On Mon, Apr 18, 2005 at 09:06:45PM +0800, Lan Yufeng wrote:
> Hi, is there any way to send notification mail with database name
> set dynamically, such as:
> Subject: FooProduct cat1/pr#123
> * FooProduct is the database name.
> 
> Because we gonna have a lot of databases, manually modify dbconfig
> for each database is time consuming.
> 
> help! Suggestion on soucecode hacking are welcome too.

My first suggestion is to use a separate email for each database.  It
is relatively easy to tell your email server to pipe to  "queue-pr
--database DATABASE".  You could probably generate a quick sed script
to walk over the dbconfig files and insert the appropriate address.

I personally email addresses named after the database in some way.
For example, [email protected].  I then use procmail to
match the "To:" and "Cc:" headers for the database name and pipe it to
the appropriate queue-pr command:

# One recipe to rule them all...
MATCH=
:0:
* ^(To|Cc): bug-\/[_-a-zA-Z0-9]+
{
	DB=$MATCH
	:0 w
	| queue-pr --database=${DB}

	:0 e
	failed-queue/${DB}/.
}

# Or you can have separate recipes for each database
:0 w
* ^(To|Cc): [email protected]
| queue-pr --database=PRODUCT

:0 e
failed-queue/PRODUCT/.

-- 
Chad Walstrom <[email protected]>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */

_______________________________________________
Help-gnats mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnats
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCY/x3DMcLGCBsWv0RApvyAJ9cmluRDbJNMaKv4UqgnEUm0hxLEwCfWjQ3
uDQmIYJ8MJiQR+LjRditAyA=
=XcId
-----END PGP SIGNATURE-----