Lewis' Blog Tales from the trenches of information technology


Mantis email fun – part 1

Download PDF

Mantis Bug Tracker is a great tool. Several friends use it (I was originally going to set up Bugzilla, as I'd had more experience from a user's perspective with it, during my years of submitting and contributing to Mozilla issues), and I finally got my chance to sink my teeth into it in 2009, when I took over the web hosting for OS/2 VOICE. In that instance, I inherited a well-oiled machine, so I had no real need to dig too far into the initial setup routines for the app.

Several months ago, I upgraded that particular installation, and set one up for myself. Naturally, as these things go, "setting one up" and actually "putting stuff into it" are two entirely different things, so until last week, when I really felt the urge, I didn't have any real chance to play with my new install.

So it was that last week I decided to check out where I left off and get an existing small project into it. (Eventually, I'll get fancy and incorporate Subversion or GIT into the Mantis setup, but for now, I just want to organize all of my electronic sticky-notes, so that I can make sense of what I've got and what I need to do moving forward). My first hurdle was that I couldn't for the life of me recall what my password was. Nothing seemed to work, and naturally, I hadn't stored it in SeaMonkey or Firefox or my other password keeper. Unperturbed, I clicked the link to send the password reset request. Nothing happened.

I logged into phpMyAdmin, where I was at least able to confirm the username and email address by examining the database. Again, I clicked the link. Nada.


I opened a remote session to my mail server, and scanned through the Communigate directories. Normally, php-submitted email gets handed off to Communigate's sendmail executable, and the resulting file lands in the Submitted directory under the Communigate root. Sure enough, there were a couple .bad files in there (upon arrival, these files have a .sub extension; if something is wrong with one of these, it is rejected by the server, and renamed with a .bad extension). I opened the latest one to find that my own email address (as recipient) was not surrounded by tags, i.e., no "<>" around it. Looking at the Communigate log, that appeared to be the reason for the rejection.

So, why was it that the VOICE emails went right through, and yet the ones from my installation were hopelessly broken?

First things first (or second things second, as the case may be). I grabbed the link in the bad email for the password reset and got that out of the way. Upon logging in, I noted the version I was running, which was 1.2.5. The latest appeared to be 1.2.8, so I downloaded that and upgraded.

Testing mail after the upgrade, I found that nothing had changed. Still, the recipient email address was broken.

Finally, I diff'd the email_api.php against the VOICE setup, running an earlier (though close) build. The two files were identical. So, the problem must lie in the config_inc.php.

Comparing those did indeed shed some light on the issue. VOICE was configured (based on the inherited setup) as $g_phpMailer_Method = 2 (which equates to SMTP; see more on this, below), and mine was set for $g_phpMailer_Method = PHPMAILER_METHOD_MAIL.

phpMailer is the component used by Mantis for relaying. As a relay, it accepts a variety of different mechanisms:

  1. 0, PHP's mail() function;
  2. 1, sendmail; or
  3. 2, SMTP

Now, on my system, PHP is configured to use sendmail, so one might think that options 0 and 1 would be synonymous, except that I have a number of other apps using one or the other with no problems whatsoever. Only Mantis (or phpMailer) seemed to have a problem leaving off (or stripping - I haven't looked closely enough, yet, to determine which) the tags around the recipient address. And, as far as I know, only VOICE's Mantis configuration is configured to use SMTP (typically used on Windows servers which lack a native sendmail by default).

So, I made the switch in my config_inc.php to $g_phpMailer_Method = PHPMAILER_METHOD_SMTP and tested. This time, the recipient address was properly formatted, and mail came right through.

The moral of the story is...well...I don't know what the moral of the story is. I suppose it's good practice to cover all the bases, though this doesn't really get to what is broken in Mantis or phpMailer or (more likely) my system. At least it gets the mail out, though!

Next time, I'll discuss tweaking some of the output text strings in the notifications which Mantis sends. Meanwhile, Happy Thanksgiving.

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.