View Issue Details Jump to Notes ] Wiki ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004286mantisbt[All Projects] Generalpublic2004-08-06 09:512012-10-05 15:10
Assigned Tograngeway 
PlatformOSOS Version
Product Version0.18.2 
Target VersionFixed in Version 
Summary0004286: Solution for reporting via E-Mail
DescriptionMaybe somebody is interested in, I have written a script for receiving bug reports through a POP3 E-Mail account.
It is based on the file bug_report.php and works this time.
Tagsadmin, email, EmailReporting, plugin
Attached Filestgz file icon Mantis.tgz [^] (2,101 bytes) 2004-08-06 10:38
patch file icon mantis-working.patch [^] (23,038 bytes) 2004-08-09 16:25 [Show Content]
patch file icon mantis-0.19.0.patch [^] (42,781 bytes) 2004-09-15 10:30 [Show Content]
patch file icon mantis-0.19.0.patch [^] (34,447 bytes) 2004-09-15 12:00 [Show Content]
patch file icon mantis-0.19.1.patch [^] (29,263 bytes) 2004-11-06 12:55 [Show Content]
patch file icon mantis-0.19.1-mime.patch [^] (38,514 bytes) 2004-11-21 11:49 [Show Content]
patch file icon mantis-0.19.2.patch [^] (39,297 bytes) 2004-12-26 08:30 [Show Content]
patch file icon mantis-0.19.2-additional-fixes.patch [^] (1,416 bytes) 2005-02-12 08:45 [Show Content]
patch file icon mantis-1.0.0rc1.patch [^] (44,881 bytes) 2005-08-07 07:02 [Show Content]
? file icon mantis-1.0.0rc1.patch-2 [^] (40,308 bytes) 2005-08-07 08:52
patch file icon mantis-1.0.0rc2.patch [^] (41,283 bytes) 2005-10-31 05:25 [Show Content]
patch file icon mantis-0.19.3.patch [^] (40,912 bytes) 2005-10-31 05:25 [Show Content]
patch file icon mantis-1.0.0rc3.patch [^] (41,385 bytes) 2005-10-31 05:25 [Show Content]
gz file icon mantis-1.0.3.patch.gz [^] (34,492 bytes) 2006-05-10 08:46
gz file icon mantis-1.0.5.patch.gz [^] (109,299 bytes) 2006-09-17 09:09
zip file icon [^] (88,472 bytes) 2007-06-06 11:51
zip file icon [^] (88,472 bytes) 2007-06-06 13:43
zip file icon [^] (88,477 bytes) 2007-06-08 20:10
? file icon Parser.php [^] (5,175 bytes) 2008-02-04 05:18 [Show Content]
patch file icon Parser.php.patch [^] (801 bytes) 2008-02-04 05:20 [Show Content]
tgz file icon Mantis-1.1.1-changed_files_only-unofficial.tgz [^] (88,898 bytes) 2008-02-04 20:58
tgz file icon Mantis-1.1.1-changed_files_only-unofficial-v1.tgz [^] (88,948 bytes) 2008-02-04 22:07
patch file icon mail_api.php.patch [^] (2,517 bytes) 2008-02-11 11:30 [Show Content]
? file icon mail_api.php.patch-v2 [^] (2,616 bytes) 2008-02-12 05:09
? file icon 1202890957da93014a9e1d86b8b0fc26e66b637721 [^] (12,353 bytes) 2008-02-13 04:51
zip file icon [^] (1,214 bytes) 2008-02-21 10:39
zip file icon [^] (130,466 bytes) 2008-07-11 08:53
zip file icon [^] (130,518 bytes) 2008-07-14 07:29
zip file icon [^] (60,416 bytes) 2009-01-21 14:40
patch file icon recmail.patch [^] (3,954 bytes) 2009-02-10 06:50 [Show Content]
patch file icon recmail_reply_attach.patch [^] (1,725 bytes) 2009-02-18 22:10 [Show Content]
zip file icon [^] (60,670 bytes) 2009-02-20 08:14
zip file icon [^] (60,666 bytes) 2009-02-20 08:40
patch file icon reject-mail.patch [^] (6,313 bytes) 2009-03-08 03:24 [Show Content]
rar file icon MantisBT-1.2.0rc1_plugin_EmailReporting-0.5.rar [^] (46,572 bytes) 2009-07-27 14:28
rar file icon MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.rar [^] (39,455 bytes) 2009-07-30 18:19
rar file icon MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.1.rar [^] (39,456 bytes) 2009-08-04 12:06
rar file icon MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.2.rar [^] (39,870 bytes) 2009-09-22 12:41
rar file icon MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.3.rar [^] (40,071 bytes) 2009-10-15 17:54
rar file icon MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.0.rar [^] (68,223 bytes) 2009-12-01 15:10
rar file icon MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.2.rar [^] (68,727 bytes) 2009-12-05 20:48
rar file icon MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.3.rar [^] (58,488 bytes) 2009-12-22 10:06
rar file icon MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.4.rar [^] (58,972 bytes) 2010-01-18 14:32
gz file icon MantisBT-1.2.0_plugin_EmailReporting-0.7.5.tar.gz [^] (80,623 bytes) 2010-02-23 04:36
gz file icon MantisBT-1.2.0_plugin_EmailReporting-0.7.6.tar.gz [^] (80,053 bytes) 2010-02-24 02:05
gz file icon MantisBT-1.2.0_plugin_EmailReporting-0.7.7.tar.gz [^] (80,222 bytes) 2010-02-25 00:54
rar file icon MantisBT-1.2.0_plugin_EmailReporting-0.7.8.rar [^] (59,669 bytes) 2010-02-27 11:45
rar file icon MantisBT-1.2.0_plugin_EmailReporting-0.7.9.rar [^] (59,759 bytes) 2010-02-28 15:16
png file icon Screenshot-folder-structure.png [^] (47,578 bytes) 2010-03-01 01:41

zip file icon [^] (11,942 bytes) 2010-03-24 04:39
patch file icon obones_feature_branch.patch [^] (21,367 bytes) 2010-04-06 08:49 [Show Content]
rar file icon MantisBT-1.2.0_plugin_EmailReporting-0.8.0.rar [^] (64,633 bytes) 2010-04-23 12:10
patch file icon events.patch [^] (5,650 bytes) 2010-04-26 09:23 [Show Content]
zip file icon [^] (2,907 bytes) 2010-04-27 02:51
diff file icon directory_trim.diff [^] (1,400 bytes) 2010-04-27 07:11 [Show Content]
patch file icon file_upload.patch [^] (8,952 bytes) 2010-04-27 07:36 [Show Content]
patch file icon file_number.patch [^] (1,389 bytes) 2010-04-27 12:11 [Show Content]
rar file icon MantisBT-1.2.1_plugin_EmailReporting-0.8.1.rar [^] (64,853 bytes) 2010-04-27 14:33
patch file icon multi_string_reply_marker.patch [^] (1,291 bytes) 2010-04-28 09:22 [Show Content]
patch file icon reply_identification.patch [^] (1,783 bytes) 2010-04-28 09:22 [Show Content]
rar file icon MantisBT-1.2.3_plugin_EmailReporting-0.8.4.rar [^] (68,226 bytes) 2010-11-25 16:34
zip file icon [^] (298 bytes) 2011-01-25 05:50
zip file icon [^] (20,538 bytes) 2011-03-18 03:49
zip file icon [^] (3,560 bytes) 2011-04-11 12:49
? file icon relaxed_bugid_reqexp_and_subject_in_note.path [^] (6,978 bytes) 2011-07-14 03:54
patch file icon note_and_new_issue_add_subject_cc_date.patch [^] (11,736 bytes) 2011-09-15 05:11 [Show Content]
patch file icon note_and_new_issue_add_subject_cc_date_to.patch [^] (12,919 bytes) 2011-09-15 06:06 [Show Content]

- Relationships
related to 0006658closedryandesign mantisbt Replying to a mantis ticket should add it as a note to that issue 
has duplicate 0001568closedgrangeway mantisbt Abillity to send mail to mantis adding bugs and bugnotes 
has duplicate 0003320closedgrangeway mantisbt Email ability 
has duplicate 0005233closedthraxisp mantisbt Submission of issues by email 
has duplicate 0005710closedthraxisp mantisbt E-Mail-Import in mantis 
has duplicate 0008339closedvboctor mantisbt email reporting 
has duplicate 0009964closedjreese mantisbt report a bug via email 
has duplicate 0010010closedthraxisp mantisbt E-mail implementation to mantis as a new bug 
has duplicate 0010550closedsiebrand mantisbt Report issue via email 
has duplicate 0011831closedatrol mantisbt Tickets can be created via email? 
has duplicate 0013049closedatrol mantisbt Report a new Bug via Email 
related to 0006619closedgrangeway mantisbt Report by email concept 
related to 0008984closedSL-Gundam Plugin - EmailReporting Adding notes to existing bug via email 
related to 0007086closedSL-Gundam Plugin - EmailReporting Mantis email via IMAP + folders 
related to 0010146closeddregad mantisbt Send/Receive mail from issue 

-  Notes
User avatar (0006704)
indy (reporter)
2004-08-06 10:39

I've put a test version to the request ;)

Have fun.
User avatar (0006706)
jlatour (reporter)
2004-08-06 10:50

I haven't tried it, but it looks good. I guess we can include this (at least until we have a more flexible e-mail interface). I would appreciate it however if you provide a patch for the project admin interface.

A few other concerns:
- There is no way for the user to know that his mail has been added to the issue tracker, nor will he get any feedback on it.
- All issues are reported by one user. Perhaps we could link that to existing users (security issues?), or show the e-mail address instead.
- I noticed you have added your own copyrights. If we do include this, we'll use the standard copyright header, without specific copyrights for that file.
User avatar (0006742)
indy (reporter)
2004-08-07 04:20
edited on: 2004-08-07 04:20

You can use it.

It's an ugly hack this time. ;)
The next step I'd like to do, is to make it possible to use the mail's from header as the reporter (maybe by adding this as a new user account).
This should be configurable.

A feedback to the user was not needed here, but of course, it's possible.
For this the mail's sender should be added as a user account.
I will do this next week, when I find a little time for this.

Use your standard copyright header!

edited on: 08-07-04 04:20
User avatar (0006743)
jlatour (reporter)
2004-08-07 04:39

OK, looking forward to see what you come up with!
User avatar (0006822)
indy (reporter)
2004-08-08 13:50

I took a look to Bug 0001568 an it seems to be possible for me.

Today I've introduced a new function for finding a user via its mailadress and one to create a new user account out of the box by a mail report.
This time, it seems to work, but I will do some more tests.
User avatar (0006824)
jlatour (reporter)
2004-08-08 15:37

I'm not going to type 'OK, keep it up!' every time you post a status update, but I am reading them :-) Consider it implicit.
User avatar (0006886)
indy (reporter)
2004-08-09 14:59

The new patch adds the following functions to bug_report_mail:

- update/remove mail account data to projects with the standard administration interface
- fetch a users id using a mail address
- auto-signup a user using a mail address if not found in users table

todo: look into subject of mails for adding bug notes
User avatar (0006891)
indy (reporter)
2004-08-09 16:27

The mantis-working patch creates user accounts in the right way and is able to recognize mails as replies to an already opened bug.
If it is so, the mail content is added as a bug note.

I think, this should be a ready-to-work solution this time :)

The patch is against Mantis 0.18.3
User avatar (0006893)
jlatour (reporter)
2004-08-09 16:39

Looks and sounds good. However, we're currently working on getting 0.19.0 out first. Could you wait until it's out and send in a patch against that (or even better, use 'cvs diff' with an up to date 0.19.0 CVS tree)?
User avatar (0006898)
indy (reporter)
2004-08-09 17:33

No problem ;)

I'll wait for it.
User avatar (0006967)
fusenigk (reporter)
2004-08-12 16:25

Hi, this looks really nice and I´m looking for a solution to report issues vie email.
As noted in some other issues, you can use the /etc/alias file to get new mails immediatly instead of doing a polling.
User avatar (0006968)
indy (reporter)
2004-08-12 16:48
edited on: 2004-08-12 16:54

> As noted in some other issues, you can use the /etc/alias file to get new mails
> immediatly instead of doing a polling.

Yes, I know this.
But there are N+1 different mailservers, and only a few use the /etc/alias database. Qmail, for example not. My first solution was a .qmail Script writing the mail into Mantis database. But it is only useable if the mailserver has the rights to write into the mantis database.

An other possibilily is to put the mail's content into a script doing a http post request. Both are solutions, I tried. But on my mantis host, I have a lot of
clients with own projects who cannot install scripts on their mailserver.
Some do not own a mailserver, some don't like such things, and so on.

But if you're interested in, I can integrate my older solution doing a http post request into this patch.

Edit: I take a look, it's only a little change :)
I think, I'll find a little time for doing this on monday.

bearbeitet am: 08-12-04 16:54
User avatar (0007596)
indy (reporter)
2004-09-15 10:35

I've added a patch for Mantis 0.19.0.
Because of possible security problems, the behaviour has changed a little:
In the default way, only one user is used for reporting.
If this is turned off, the sender's address will be searched in user database.
So it is possible now, to allow always registered users to report via mail without creating accounts for unknown users.
This could be activated with a separate variable.

The next thing, i will integrate is the possibility to have more than one mailaccount for every project. Some people asked me to add support for mail accounts per category.

Have fun...

User avatar (0007597)
Matt_wc (reporter)
2004-09-15 10:43

This is fantastic stuff! Keep it up.

May I put up an idea: if you create a user account from the email (if one was not found), would you then delete the new account when the issue is closed? (as an option)

Again - great work.
User avatar (0007600)
indy (reporter)
2004-09-15 11:14

> if you create a user account from the email (if one was not found), would you
> then delete the new account when the issue is closed? (as an option)
Hm... It is possible, of course.
But I think, if the user account is deleted, there are bug reports with no reporter.
If you want it, I will add it as a separate configuration option.
User avatar (0007603)
Matt_wc (reporter)
2004-09-15 11:28

This seems to be related to an old issue 3320: Email ability [^]
User avatar (0007604)
Matt_wc (reporter)
2004-09-15 11:35

On having a bug with no reporter... I agree it is not the best idea - even if it is closed, it would be good to know who reported the issue for future reference.

Will give this more thought.
User avatar (0007605)
indy (reporter)
2004-09-15 12:01

I'm sorry, the first patch i added today is not really good.
I forgot to remove comments on three lines.

The newer will work. Sorry.
User avatar (0007930)
anarcat (reporter)
2004-10-05 23:04

why isn't this bug marked as related to the bug 3320?
User avatar (0008051)
joho (reporter)
2004-10-15 05:10

Any chance we can get a version that works on stdin? This would be awesome for people using software like qmail where it makes more sense to pipe input directly from a .qmail file (this also puts a smaller load on the server in that it's only done when mail is actually received).

Using the CLI-interface, PHP files can be invoked/executed from the command-line like any other type of script. So no need to go via the webserver.
User avatar (0008052)
indy (reporter)
2004-10-15 08:22

Yes, of course it's possible.
I use qmail myself, so I'm working on it.
User avatar (0008385)
indy (reporter)
2004-11-21 11:54

The newest patch is able to handle MIME-Mails in a correct way.
The attachments are added as new files to a bug.
The Mail_MIME package from PEAR is used for parsing.

It works on my system, please test :)


By the way...

I have no idea this time to handle mails via stdin in a correct way.
In this case I have to look for a projects id searching with the mail address,
this is a little bit complicated because there can be also special mailadresses
for each category.
Maybe, if I've a little time in the next weeks, I'll find a solution.

Ouhps: please remove the comment from line 224 in mail_api.php ;)
User avatar (0008813)
indy (reporter)
2004-12-26 08:34

Update to Mantis 0.19.2.

I've added new configuration options, see README.bug_report_mail for details.
Also, some bugs in the MIME handling are fixed and it is possible now, to run the script via the CLI.
(For this I needed two dirties, maybe, somebody could take a look and beautify this because I don't know how to do ;)
User avatar (0008905)
csteeg (reporter)
2005-01-10 05:22

Could someone please just include a download wich can be copied to/over the 0.19.2 version.
It's a PINTA to get it patched under windows
User avatar (0009029)
indy (reporter)
2005-01-15 10:24

A complete Mantis 0.19.2 including this patch can be downloaded here: [^]
User avatar (0009294)
gernot (reporter)
2005-02-12 08:43

Looks really nice. I'm currently in the process of installing a new Mantis with this patch applied and testing it.

However, I found some small problems when the mails are sent via PINE:

- MIME handling: Pine always sets the MIME-Version header, even for text/plain msgs. These are tried to decode by the script which fails. I added a check if the Content-Type is really "multipart".
- MIME handling: Content-Type is set to "TEXT/PLAIN" instead of "text/plain" by Pine. Added strtolower
- general: I really don't like the idea of auto-sign-ups. Therefore, I use the "Mail" account for reports - but then you can't see who reported a bug at all. Therefore I added a "Report from mail@address.fff:" line to the description.

Please see my patch mantis-0.19.2-additional-fixes.patch and include it to your patch if you like it. The patch has to be applied after mantis-0.19.2.patch.
User avatar (0009295)
gernot (reporter)
2005-02-12 08:52

BTW, indy: I think you should change the status of this bug away from "feedback", otherwise it might be overlooked as Mantis developers think you still haven't answered their questions...
User avatar (0009296)
gernot (reporter)
2005-02-12 09:25

Another remark (hopefully the last for today, sorry :( ):

I additionally needed to patch Mail_Mime 1.2.1 according to [^] so that it will also decode mails with encoding "BASE64" instead of "base64".
User avatar (0009300)
indy (reporter)
2005-02-13 09:39

gernot: I do not have any privileges to change the state for this report.
In the next version, I will include your changes! :)
Thank you!
User avatar (0009351)
gernot (reporter)
2005-02-20 07:15

Additional remark: if you call bug_report_mail.php from the command line via "php", the host and path settings of your server will not be found. This leads to an incorrect message sent upon user registration ( instead of your server name, wrong path).

So if you want to use this script via "Php" command line, you have to manually set $t_host and $t_path (at least, I didn't try it yet).
User avatar (0009964)
jbrouhard (reporter)
2005-04-29 11:44

> A complete Mantis 0.19.2 including this patch can be downloaded here:
> [^] [^]

I get a 404 here?

I would *REALLY* like to test this out as I use a live bug-tracking system for a database-driven website that controls not only content to a site, but a organization's own reporting and membership system.

Thanks in advance!
User avatar (0009965)
indy (reporter)
2005-04-29 11:58

I've put the patches and the modified version of Mantis back into the download-area.
User avatar (0009966)
jbrouhard (reporter)
2005-04-29 12:12

User avatar (0010600)
DTG (reporter)
2005-06-22 04:16

Will this patch also become available for the new 1.x.x version of Mantis?
User avatar (0010601)
indy (reporter)
2005-06-22 04:36

Of course, but in the moment, I've not enough time to do this.
User avatar (0010649)
stevenc (reporter)
2005-06-30 04:51

I found a bug which prevented the body of an mime email to be added in the description field of a new bug report.

file: core/mail.api.php
function: mail_parse_content ( $p_mail )

if (strtolower($t_parts[0]['Content-Type']) == 'text/plain' ||
    strtolower($t_parts[0]['Content-Type']) == 'text/html')
    //$t_body = array_shift($t_parts); //remove this line
    $t_body['Body'] = $t_parts[0]['Body']; //replace it with this one should fix the problem
    $t_body['Body'] = "It seems, there is no text... :-o";
User avatar (0010696)
jbrouhard (reporter)
2005-07-08 13:03

Fatal error: main(): Failed opening required 'Net/POP3.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/virtual/sfmc/public_html/admin/bugs/core/mail_api.php on line 22

I get this error from the cron.. I have this on a virtual host (hosting partner)... It's not permissions as the file is chmod' 655..
User avatar (0010697)
rainman (reporter)
2005-07-08 15:59

I've got a problem (maybe my stupidity).
The POP3 connection and login work OK, but $t_pop3->numMsg() returns a false (error) no matter whether there are messages on the POP3 account or not. Has anyone seen this? Any ideas on how to fix it? I'm running the latest 0.19.2 patches.
User avatar (0010699)
indy (reporter)
2005-07-09 05:50

@jbrouhard: You need the Net_POP3 package from PEAR.
It located here: [^]

@rainman: What's your POP3 server?
Maybe you have to patch the Net_POP3 package, sometimes (especially with Courier-POP3) there are courious behaviours.
User avatar (0010710)
rainman (reporter)
2005-07-11 08:33

The POP3 server is an Exchange server with POP3 access.

I turned the debugging on in Net_POP3 and I've been diving through the code. I found a missing Auth_SASL package (which appeared to be optional, but I installed it anyway), but so far I still have a problem. I think I'm close. I'll post a followup if I get it working. I expect I'm missing another package.
User avatar (0010711)
rainman (reporter)
2005-07-11 09:34

This is the exact server version I am running:
Microsoft Exchange 2000 POP3 server version 6.0.6603.0

It appears that I have an authorization problem. Here is the error I am getting: USER NOT supported authentication method!. This server supports these methods: NTLM, but I support DIGEST-MD5,CRAM-MD5,APOP,PLAIN,LOGIN,USER
User avatar (0010712)
jbrouhard (reporter)
2005-07-11 09:38

rainman: you might be able to changhe the settings on the Exchange server to allow for PLAIN login, or even APOP login. NTLM is Exchange's hook to the Active Directory. We run Exchange 5.5 where I work, so I can't really check this out.
User avatar (0010713)
rainman (reporter)
2005-07-11 09:49

OK. The problem appears to be between the exchange POP3 server and Pear::Net_POP3 negotiating the authenitication method. If I hard code the auth method to 'USER' it logs in OK. I will attempt to take it up with the Net_POP3 folks.
User avatar (0010718)
rainman (reporter)
2005-07-11 17:19

Found a minor problem with the attachment functionality:

My POP3 server (MS Exchange (ARGH!)) was sending the message in multiple parts that ended up causing the mail_add_file function to try to save a file with no name. I think that this is because the user was sending the mail formatted in HTML, so the message was considered an attachment, but there was no name. There's probably a better way to fix this, but here's what I did to fix it:

In file mail_api.php

    function mail_add_file( $p_bug_id, $p_part ) {
            $GLOBALS['_mail_file_'] = $p_part['Name'];
            // Add the following if statement to prevent trying to add an
            // empty file
            if (0 < strlen($p_part['Name']) ) {
                $t_file_name = '/tmp/'.$p_part['Name'];
                $num_bytes = file_put_contents($t_file_name, $p_part['Body']);
                file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug');
User avatar (0010723)
jbrouhard (reporter)
2005-07-11 23:41

The Server admin got the Net_POP3 pear package installed, and now i'm getting:

Fatal error: main(): Failed opening required 'Mail/mimeDecode.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/virtual/sfmc/public_html/admin/bugs/core/mail_api.php on line 23

I'm guessing mimeDecode is missing ?
User avatar (0010730)
indy (reporter)
2005-07-12 07:21

I think this package is missing: [^]
User avatar (0010738)
rainman (reporter)
2005-07-12 11:03

I found that the function to add a bugnote was not working because my project name in Mantis had a space in it. The bug id in the brackets looked something like this [Project Name 0000341]. To fix this I added a space into the regex in the mail_is_a_bugnote function and the mail_get_bug_id_from_subject function in mail_api.php.

Old regex example: return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_mail_subject);
New regex example: return preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{7})\]/", $p_mail_subject);

I think maybe I goofed when creating a project with a space in the name, but this fixes the problem.
User avatar (0010887)
indy (reporter)
2005-07-20 07:54

Thanks a lot for the bugfixes and patches.
Sunday (24.07.) I'll create a new release for Mantis 1.0.0a3.
User avatar (0011092)
indy (reporter)
2005-08-07 07:03


the first patch for Mantis 1.0.0rc1 is submitted.
I'm sorry - the attachments won't work this time - I will fix this within the next days.

Feel free to test!
User avatar (0011094)
indy (reporter)
2005-08-07 08:51

Now, the file adding seems to work!

A complete version of Mantis 1.0.0rc1 including all required packages is available for download. [^]
User avatar (0011137)
dapozzom (reporter)
2005-08-10 06:42

I tried to download the solution from "" [^] but the file downloaded is corrupted
User avatar (0011138)
indy (reporter)
2005-08-10 07:03

I've load the file up again.

There's also a bzip2 archive in the directory, try this one, if the ZIP archive fails again. (I hate ZIP *gah*)
User avatar (0011139)
dapozzom (reporter)
2005-08-10 08:17

User avatar (0011167)
drtns (reporter)
2005-08-11 10:28

Having an install issue... pulled down the above mentioned mantis-1.0rc1 bzip with the patches rolled in, went to the admin dir, tried to upgrade the DB and got the following error..

Parse error: parse error, expecting `')'' in /var/www/html/newmantis/admin/schema.php on line 349

line 349 is:

    "(2, 'mail', 'Mail Reporter', 'nomail@localhost', 'a268462c3c679a9027658c5aa723f97c', '2003-02-16 02:03:48', '2004-07-08 23:59:22', 1, 0, 25, 0, 0, 0, MD5(NOW()))" )

I also get the same error with the login page
User avatar (0011278)
drtns (reporter)
2005-08-24 09:59

Fixed my issue, not sure if this is somthing that needs to be looked at... the problem was as follows - *note* I had to change the 'id' as I am upgrading an existing mantis and already had a user with id=2

--- mantis-1.0.0rc1/admin/schema.php 2005-08-24 09:58:20.000000000 -0400
+++ /var/www/html/newmantis/admin/schema.php 2005-08-24 09:56:52.000000000 -0400
@@ -344,8 +344,10 @@
 $upgrade[] = Array('CreateIndexSQL',Array('idx_enable',config_get('mantis_user_table'),'enabled'));
 $upgrade[] = Array('CreateIndexSQL',Array('idx_access',config_get('mantis_user_table'),'access_level'));
-$upgrade[] = Array('InsertData', Array( config_get('mantis_user_table'),
- "(1, 'administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', '2003-02-16 02:03:48', '2004-07-08 23:59:22', 1, 1, 90, 3, 0, 0, MD5(NOW()))" )
+$upgrade[] = Array( 'InsertData', Array( config_get('mantis_user_table'),
+ "(1, 'administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', '2003-02-16 02:03:48', '2004-07-08 23:59:22', 1, 1, 90, 3, 0, 0, MD5(NOW()))" ));
+$upgrade[] = Array( 'InsertData', Array( config_get('mantis_user_table'),
     "(30, 'mail', 'Mail Reporter', 'nomail@localhost', 'a268462c3c679a9027658c5aa723f97c', '2003-02-16 02:03:48', '2004-07-08 23:59:22', 1, 0, 25, 0, 0, 0, MD5(NOW()))" )

Basically I needed to add the $upgrade[] ... line to the seccond 'mail' user addition code.
User avatar (0011279)
drtns (reporter)
2005-08-24 12:04

When I run the bug_report_mail.php

I get the following error:

APPLICATION WARNING #100: Configuration option 'mail_debug' not found.

APPLICATION WARNING #100: Configuration option 'mail_debug' not found.

However I am still getting the tickets created in my test project under the catagory which they are supose to.

What config file is the mail_debug variable suposed to be set in? and what is the recomended value for this option.
User avatar (0011280)
drtns (reporter)
2005-08-24 12:41


Is it possible for this to support pop3s as well? out mail server doesn't use pop3 for security reasons. I am working around it right now but my solution is a bit of a kludge.
User avatar (0011281)
drtns (reporter)
2005-08-24 13:45


The install doesn't take into consideration that you may be upgrading an existing DB.

When it tries to create the mail user it does so with and ID of two... this wont work if you have existing users in your db.

The program sould do a "select max(id) from mantis_user_table;" and then incriment that value by 1, assigning max(id)+1 to the id field for the creation of the mail user.
User avatar (0011282)
drtns (reporter)
2005-08-24 13:53


E-mail Ticket addition kacks if there is no subject in the e-mail...

If the e-mail sent to the box which mantis checks for e-mail tickets contains no subject it will not insert the ticket to the project with a "No Summary" error:


A necessary field 'Summary' was empty. Please recheck your inputs.

To make matters worse the e-mail ticket is also del'ed which can lead to a situation where you can get accused of not responding to an issue, because as far as the user is concern their e-mail was delivered even though the bug_report_mail.php/mantis thew the isssue on the floor

The mail_api.php should be changed to look and see if the Subject string is empty and write in a default subject so that when it's handed off to mantis it will properly insert the bug to your project.
User avatar (0011283)
drtns (reporter)
2005-08-24 15:23

Right now this works great for submittion via e-mail however it's practical application is limited due to the fact that all future tracking after the inital e-mail is limited to mantis-only conversation.

Is it planned to have this grow to the point where the origional submitter will be e-mailed on each ticket update? as well as an inital tracking ticket which they can reply to, which will automatically update the mantis bug?

Without the ability to carry on a conversation regarding the bug over e-mail the usefullness of the submittion via e-mail is limited.
User avatar (0011287)
indy (reporter)
2005-08-25 03:04

@drtns: POP3S is possible if it's supported by the Net_POP3 package.
I don't know the current state of this feature, but I'll try enabling this.

The answer for submitters is already possible, if you enable creating of a new account for email reporters.

Your patch will be integrated ASAP, thanks!
User avatar (0011299)
dapozzom (reporter)
2005-08-26 04:41

In my case I received too the APPLICATION WARNING 100: Configuration option 'mail_debug' not found with no issue created
User avatar (0011313)
moppel (reporter)
2005-08-30 15:30

Can anybody provide a list of features needed or bugs to be resolved until this feature can be integrated into a mantis-version?
User avatar (0011325)
indy (reporter)
2005-08-31 05:46

Of course:

- I have to fix a bug in database layout
- the default value for mail_debug has to be set

- check for IMAP and SSL support for POP3/IMAP
User avatar (0011431)
ratman (reporter)
2005-09-26 11:06
edited on: 2005-09-27 05:48

Hi guys,
Can I have a mail sample?
My mail server seems to be empty but the mails are there. I think it a mail format problem.
Is it possible that doesn't work because my mail server is Lotus Notes?

Thanks to all

User avatar (0011447)
alsutton (reporter)
2005-09-29 10:42

Hi all,

If a 1.0.0rc2 patch is made can instructions be included on how to apply it to an already configured system? (I've already deleted the admin directory as directed so the schema.php will fail).


User avatar (0011454)
indy (reporter)
2005-09-30 05:52

I'll make a patch for 1.0.0rc2 this weekend and include a mail sample and an installation howto!
User avatar (0011549)
fafnir (reporter)
2005-10-27 03:45

Will there be a patch for RC 1.0.0rc2? Or will the patch for rc1 work as well? Keep up the good work!
User avatar (0011550)
indy (reporter)
2005-10-27 03:54

I'm sorry - until now I was not able to take enough time for making a new patch set for Mantis 0.19.3 and 1.0.0rc2.

Maybe, the current patches will work, but there are still some bugs.
User avatar (0011554)
moppel (reporter)
2005-10-27 08:37

Are there any plans to integrate this feature in Mantis in an official release?
User avatar (0011564)
indy (reporter)
2005-10-31 05:29

Jo... I'm ready.
It's been taking a long time, but now, the patches for the current stable and development releases are ready.
Feel free to test it.

For Windows users I'll put ZIP-archives including the patch and necessary stuff on [^]

Including the patch into official release would be nice, but I have not the privileges to decide this.
User avatar (0011568)
jlatour (reporter)
2005-11-01 07:48

The code looks really nice and clean, I think we can integrate this after we put out 1.0 (we want to finally get that out first).

A few notes:
- I see a debug line at the top of bug_report_mail.php
- There doesn't seem to be an upgrade script for the database (integrated in the standard upgrade procedure) - could you add your alter queries to the script?
- You chose a password for the mail user? Maybe we should set the MD5-ed value to an impossible hash, to make sure that no one can log in to any Mantis installation.
- The README will have to be integrated into the manual

Really impressive work!
User avatar (0011575)
indy (reporter)
2005-11-01 16:41

> - I see a debug line at the top of bug_report_mail.php
Yes, I forgot to remove this line... Sorry

> - There doesn't seem to be an upgrade script for the database (integrated in the
> standard upgrade procedure) - could you add your alter queries to the script?
> - You chose a password for the mail user? Maybe we should set the MD5-ed value
> - The README will have to be integrated into the manual
Yes, of course, it's possible. I'll do this in the patch for the next release.

> Really impressive work!
User avatar (0011598)
reality (reporter)
2005-11-07 07:18

Hi. I've used Mantis 1.0.0rc2 patch. If I send mail with subject, mail body and attachment I get "It seems, there is no text... :-o" in bug description field. My settings are:
        $g_mail_reporter = "Mail";
        $g_mail_use_reporter = ON;
        $g_mail_auto_signup = OFF;
        $g_mail_parse_mime = ON;
        $g_mail_save_from = OFF;
Is it a bug or my settings are incorrect?
User avatar (0011599)
indy (reporter)
2005-11-07 08:44

This could be a bug.

Maybe, please send me you testmail to I'll take a look.
User avatar (0011675)
cube23 (reporter)
2005-11-30 16:53

poll mail cron info.

If someone need a win32 cron running as a service(i try it with XP Pro),
to poll mails or execute da "bug_report_mail.php" from da commandline...

i use a ".cmd" batchfile with "c:\...\php c:\...\bug_report_mail.php"
for the crontab.

It works great with a freeware from [^]

greetz & great work indy
User avatar (0011709)
jaapandre (reporter)
2005-12-07 03:50

nice work, you have done so far. I hope this will improve our work substantially, unfortunately:
patching admin/schema.php failed for rc3, other files were ok.
3 out of 3 hunks FAILED -- saving rejects to file mantis-1.0.0rc3/admin/schema.php.rej

investigating it a little further: in mantis-1.0.3rc3tar.gz schema.php had ^M (control-M) at the end of every line, so patch couldn't find the lines.... removing them, solved the issue.
User avatar (0011842)
indy (reporter)
2005-12-23 09:25

Hi all,

I've made a quick and dirty patch for Mantis 0.19.4 and 1.0.0rc4.

It's available here: [^]

Until now, I haven't found enough time to test it, but I hope it's working.

So long...
User avatar (0011908)
jaapandre (reporter)
2006-01-11 11:20

It's all working!!!!!
I use rc3 a few remarks:
1) in mail_api.php line 250 was:
so mail was not deleted and so only the first messages was imported to mantis over and over again, removing # fixed this
2) if you add a note via email to an existing issue with in config_inc.php:
   $g_mail_use_reporter = ON;
   $g_mail_save_from = ON;
the sender is not added to the note.
3) determing the issueId from subject is done with preg_match("/\[([A-Za-z0-9-_\. ]*\s([0-9]{7}?))\]/",....... but '&' is also allowed as character in a project name, but is not allowed in preg_match. Maybe more characters are missing from that preg_match. Work around: don't use a project name as it is not used, but put a space between first bracket and issueId
4) removed newlines at mail_api.php and bug_report_mail.php, but maybe i added them as well ;-)
User avatar (0011929)
dapozzom (reporter)
2006-01-13 07:42

I've the following two problems
1) getting the mail the message
A necessary field 'Riassunto' was empty. Please recheck your inputs.
Also if the bug is correctly created in mantis
2)the getting loads only the first mail into mantis and delete the mail to have all the mail loaded in mantis I need to rerun the the getting so seven mail seven executition of bug_report_mail.php
User avatar (0011931)
jaapandre (reporter)
2006-01-13 08:44

regarding bugnote id 11929 ad 2) Only load one message:
This is a feature which can be set in config_inc.php:
    # How many mails should be fetched at the same time
    # If big mails with attachments should be received, specify only one
    $g_mail_fetch_max = 1;
See also doc/README.bug_report_mail
User avatar (0011932)
dapozzom (reporter)
2006-01-13 09:00

In my configuration the parameter is set to 20
User avatar (0011933)
indy (reporter)
2006-01-13 09:09

Maybe, this could be to large.
Please check the memory limit for PHP.
User avatar (0011982)
lig (reporter)
2006-01-20 03:20

i've posted conceptual issue 0006619.
i think concept of reporting by email in the public release must look like this.
User avatar (0012075)
jaapandre (reporter)
2006-02-03 12:22

I have to problems with this patch:
1) mime_mail is not handled correct, the text and html version is put in note-field (is add note, maybe add issue is handled correct).
2) checking for new mail, gives in the logfiles an authentication error:
cyrus/pop3d[8569]: login:[ipadres] account plaintext
cyrus/pop3d[8569]: could not find password
cyrus/pop3d[8569]: badlogin: examplecom[ipadres] APOP (<id>) SASL(-13): user not found: could not find password
User avatar (0012077)
rainman (reporter)
2006-02-03 13:15

FYI: I'm using an older release with my own bug fixes (see notes above) but I found a situation where when one of the reporter email addresses was invalid, the reply from the postmaster was added as a note, which caused another email to go out to the reporter, which caused another reply from the postmaster ... Well, you get the picture. I fixed it by checking the from address and ignoring emails from the postmaster, however there's probably a smarter way to fix it.
User avatar (0012140)
mc (reporter)
2006-02-13 15:10

Can i use 1.0.0rc3 patch for Mantis 1.0.0 relase?
User avatar (0012143)
dapozzom (reporter)
2006-02-14 02:28

I'm using the patch with 1.0.0 and works fine.
User avatar (0012202)
Nekronomekron (reporter)
2006-02-21 05:36

Hy guys,

I am very interested in this feature of Mantis but I don't have the possiblities to test this patch at the moment.

My question is: How does the E-Mails look like?? Is it difficult to write them, that the system can work with them? Is it a very robust system, or is it possible that a single character can crash the whole system??

C YA - []Nekro
User avatar (0012206)
EBY (reporter)
2006-02-21 23:28

I just installed this patch to 1.0.1 and it is great! A few little glitches I have noticed:

-Email are not removed from the mailbox. Easily solved as indicated by jaapandre
on 01-11-06 11:20 below...
-If I send a Plain Text + HTML file, which results in a multi-part message in MIME format... then the email is not extracted properly into the issue description.
User avatar (0012207)
indy (reporter)
2006-02-22 00:51

Hi there,

I'm working on the next "release".
It supports correct handling of MS Outlook mails (especially multipart mails), decoding of base64 and utf-8 encoded messages and some more bugfixes and patches people sent me.

I'll submit it after the 5th of march (after the chemnitzer linux days)

So long...

User avatar (0012210)
EBY (reporter)
2006-02-22 09:36

Would there be an easy way to:

-Keep the emails on the mail server but avoid creating new issues each time they are fetched without deleting the emails? I would like to keep a trace in my mailbox. What I do for now is a rule on the mail server to copy email to a second mailbox from which mantis will fetch emails and deletes them afterward.
-When adding notes through email to an existing issue, parse the content to only add the reply from the sender added... notes become big quickly and notification emails sent out can become hard to read for end users.
-This one is more a mantis issue but could the notification emails for new notes only contain the last note with out of the box configuration? I know that I could do this through customization, just hoping there is a setting that I did not find! This would take care of my previous question.
User avatar (0012217)
Nekronomekron (reporter)
2006-02-24 02:32


How can I apply the patch to my mantis system?? Which programm do I need?? I am using a WindowsXP OS...

C YA - Nekro
User avatar (0012218)
indy (reporter)
2006-02-24 03:17

Take a look to this site: [^]

I offer some patched archives of Mantis for download.
User avatar (0012226)
EBY (reporter)
2006-02-24 22:46
edited on: 2006-02-25 04:05

I cannot get the email attachment to be added to my issues. I have the Mail_MIME package installed... and I can attach file to other issues for the same project manually just fine. Any idea what else I could check?

EDIT: Ok, I isolated the problem to this line that fails in file_api.php: move_uploaded_file( $p_tmp_file, $t_disk_file_name ) I checked both src and dest file names and they are Ok... plus I see the uploaded file created properly in my /tmp/ directory. It does not seem to be linked to privileges and I have safe mode OFF. I am using DISK upload.

EDIT 2: Was this tested under Linux with DISK storage? From what I read, the move_uploaded_file function will only work if the file being moved was actually uploaded. When you save the file you got from the POP3 server to the /tmp/ directory it does not look like it qualifies for that function and it refuses to move it to my project's upload folder. I finally got it to work like this:

    #if ( !move_uploaded_file( $p_tmp_file, $t_disk_file_name ) ) {
    if ( !rename( $p_tmp_file, $t_disk_file_name ) ) {
        #trigger_error( FILE_MOVE_FAILED, ERROR ); - error in constant name...
        trigger_error( ERROR_FILE_MOVE_FAILED, ERROR );
    chmod( $t_disk_file_name, 0400 );

    function mail_add_file( $p_bug_id, $p_part ) {
        $GLOBALS['_mail_file_'] = $p_part['Name'];
        if ( 0 < strlen($p_part['Name']) ) {
            $t_file_name = '/tmp/'.$p_part['Name'];
            file_put_contents($t_file_name, $p_part['Body']);
            file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug');
I really have limited PHP knowledge... but this did the trick for me, I finally get attachments for my Email reports! I am running you Email patch for 1.0.0rc4 on Mantis 1.0.1.

User avatar (0012271)
EBY (reporter)
2006-03-02 22:51
edited on: 2006-03-17 09:36

What about setting the priority in Mantis based on if the email is sent with low / normal / high priority? Using a set of variables to configure to what the email priority should translate into Mantis priority...

EDIT: Made a quick & dirty patch to enable this, seems to work OK:

    $g_mail_use_bug_priority = ON;
    $g_mail_bug_priority_default = NORMAL;
    #dirty... yuk!
    #X-Priority... depends how set by mail server...
    $g_mail_bug_priority = array( '5 (Lowest)' => 10,
                    '4 (Low)' => 20,
                    '3 (Normal)' => 30,
                    '2 (High)' => 40,
                    '1 (Highest)' => 50,
                    '5' => 20,
                    '4' => 20,
                    '3' => 30,
                    '2' => 40,
                    '1' => 50,
                    '0' => 10,
                    'Low' => 20,
                    'Normal' =>30,
                    'High' => 40,
                    '' => 30,
                    '?' => 30 );

mail_api.php - mail_parse_content
        $v_mail['Subject'] = $t_structure->headers['subject'];
        $t_mail_use_bug_priority = config_get( 'mail_use_bug_priority' );
        if($t_mail_use_bug_priority == true)
            $v_mail['X-Priority'] = $t_structure->headers['Priority'];


mail_api.php - mail_add_bug
        $t_mail_save_from = config_get( 'mail_save_from' );
        $t_mail_use_bug_priority = config_get( 'mail_use_bug_priority' );
        $t_mail_bug_priority_default = config_get( 'mail_bug_priority_default' );
        $t_mail_bug_priority = config_get( 'mail_bug_priority' );

        $t_bug_data = new BugData;
        $t_bug_data->severity = 50;
        if ($t_mail_use_bug_priority == true)
            $t_bug_data->priority = $t_mail_bug_priority[$p_mail['X-Priority']];
            $t_bug_data->priority = gpc_get_int( 'priority', $t_mail_bug_priority_default );

        $t_bug_data->summary = $p_mail['Subject'];

User avatar (0012659)
EBY (reporter)
2006-04-21 15:10

Indy, you indicated that you had a new release in the work for better Outlook support... will this be released for 1.0.x or will it be only ready for the 1.1 release that will incorporate the email reporting feature?

I am having numerous problems with Outlook emails which make email submission unreliable in my environment. I am eagerly waiting for any improvements!
User avatar (0012660)
indy (reporter)
2006-04-21 15:15


I'm sorry.
At the moment I'm working on my diploma thesis.
And I have a fulltime job.

On May, 2nd the thesis period will be over, then I'll offer new patches with some new features and fixes, especially for mails sent with Outlook.

So long...
User avatar (0012813)
indy (reporter)
2006-05-10 08:54


I'm back ;-)

Now, a patch for Mantis 1.0.3 is available.
It contains support for HTML content and encoded mails.

I've also added the patches by EBY with some minor changes.

In this version, the processing of mails changed: bug_report_mail no longer fetches all mails into an array.
The mails are fetched one after another from the mail server and are processed directly.

Feel free to test and report bugs, if there are any.

So long...

User avatar (0012949)
ericb (reporter)
2006-06-09 00:02

Can someone clariy for me what this patch will do? I've installed it and can get incoming emails to be added as new issues. But, what I really want to accomplish is allowing users to reply to emails that mantis sends out on existing issues and have their reply added as a note to the issue. Can this patch do that? My testing is just with simple text emails.
User avatar (0012985)
bmccool (reporter)
2006-06-19 07:05

How exactly would i set this up on a Windows server with exchange running in the background? My linux knowledge leaves much to be desired.

My mantis installation is currently running 100% with no issues but it is a business requirement that can accept incoming emails for tickets.

I've been through the entire note list so far and not much has been cleared up.
User avatar (0012996)
bmccool (reporter)
2006-06-20 04:02

^^^ignore that, i got it working \o/ ^^^

Sort of, anyway.

I've added the following to my config_inc.php
$g_mail_auto_signup = ON;
$g_mail_parse_mime = ON;

The MIME parsing is functioning correctly but the auto signup is not. I've snt mails from various accounts but it always reports the user as the mail reporter. I've since deleted the mail reporter user and now the tickets have no reporter whatsoever.

Any help there pls.

Also, i've noticed that the version number have a conflict. I've loaded a test version of mantis 1.0.3 and the latest mail patch but the version number displaying at the bottom of the screen reports Mantis 1.0.0rc4.

Any help would be appreciated!
User avatar (0013000)
EBY (reporter)
2006-06-20 16:41
edited on: 2006-06-20 17:04

Just got around to try to install your latest patch... could there be an error with the patch file, I highlighted in bold what I think should not be there, i.e. replace with 'mantis_project_table'. BTW, I am applying the patch to a clean 1.0.3 install.

 $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project_file_table'),"
@@ -222,7 +225,11 @@
   view_state I2 NOTNULL DEFAULT '10',
   access_min I2 NOTNULL DEFAULT '10',
   file_path C(250) NOTNULL DEFAULT \" '' \",
- description XS NOTNULL
+ description XS NOTNULL,
+ pop3_host C(250) NULL,
+ pop3_user C(250) NULL,
+ pop3_pass C(250) NULL,
+ pop3_categories L NOTNULL DEFAULT '0'
 ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));
 $upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',config_get('mantis_project_table'),'id'));
 $upgrade[] = Array('CreateIndexSQL',Array('idx_project_name',config_get('mantis_project_table'),'name',Array('UNIQUE')));

Update: I found other issues in the patch file for the following files, could you have done your diff on a 'non default 1.0.3' build? I patched files manually and all seems fine now.

File to patch: mantis-1.0.3/admin/schema.php
File to patch: mantis-1.0.3/manage_proj_mail_update.php
File to patch: mantis-1.0.3/manage_proj_edit_page.php

User avatar (0013005)
bmccool (reporter)
2006-06-21 05:34

okay then, i was just being stupid...

Got my mails working. It sends and receives emails without attachments briliantly.

Problem now comes in when i send a message with an attachment(doesn't matter if it is the first issue or any of the subsequent responses). The issue will be created and the subject is placed in the summary field but in the description it states "It seems, there is no text... :-o"

The file does not get attached to the issue either.
User avatar (0013049)
bmccool (reporter)
2006-06-29 05:11

how would i go about setting the following?

I need to exclude all email addresses (except internal) from receiving the signup notification.

I also need to exclude certain email addresses from receiving any mails whatsoever. These will be messages that come from other systems relating to downtime, program errors, etc.

Any help would be appreciated!
User avatar (0013084)
bmccool (reporter)
2006-07-11 09:25

Is indy still around?

I need to install the 1.0.3 patch but i need the windows version... I checked his site and there is nothing available. The last patch is

I have a feeling that this patch will resolve my issues.
User avatar (0013086)
indy (reporter)
2006-07-11 13:07

Yes, he is ;-)

I'll create a patched version of Mantis 1.0.3 this evening and post the URL here.
User avatar (0013088)
bmccool (reporter)
2006-07-12 03:28

Thanks indy, any news on that URL?
User avatar (0013089)
cas (reporter)
2006-07-12 06:53
edited on: 2006-07-12 07:00

using Mantis 1.0.1 I noticed that although mail_fetch_max was set to 1, multiple emails were imported and not all correct.
Not sure why this happens but managed to correct this in mail_api.php, function mail_process_all_mails.

I changed this:
for ($j = 1; $j <= $t_pop3->numMsg(); $j++ )

into this :
if ($t_mail_fetch_max <=$t_pop3->numMsg()){
    $limit = $t_mail_fetch_max;
} else{
    $limit = $t_pop3->numMsg();
for ($j = 1; $j <= $limit; $j++ )

Most likely there is a better way, if so please let us know.

User avatar (0013102)
indy (reporter)
2006-07-16 08:28


patched versions of Mantis 1.0.3 are available now: [^]

So long...
User avatar (0013109)
bmccool (reporter)
2006-07-18 05:45

Thanks for the patched release.

Strange error though. If i install a new version then the db is setup perfectly. If i update an existing installation then the db changes are not applied.

I cannot access the manage projects section as i get the following error:

Database query failed. Error received from database was #1054: Unknown column 'pop3_host' in 'field list' for the query: SELECT pop3_host, pop3_user, pop3_pass, pop3_categories
FROM mantis_project_table
WHERE id='14'
I've checked the db and true enough the mentioned fields do not exist. They do exist on a new installation though.

This is causing a bit of a problem as i cannot upgrade my current live release to the latest version.

Any ideas?
User avatar (0013110)
indy (reporter)
2006-07-18 05:52

Please take a look to doc/README.bug_report_mail


If you are alway running Mantis you have to alter your projects table
with the sql/bug_report_mail.sql script.
If not, you can create the database tables in the way described in
the doc/INSTALL file.

So long...

User avatar (0013114)
bmccool (reporter)
2006-07-19 07:00

Yeah, sorry about that. The typo had me a bit confused... I think alway should actually be already.

Different problem now though...

I've enabled auto_signup to create a user for each incoming ticket.

It imports the first mail from a user perfectly but if i submit a 2nd email it will not import the data.

I enabled debugging and ran bug_report_mail.php in IE. The following displays:

Array ( [0] => Array ( [0] => 27 [id] => 27 [1] => Mail Requests [name] => Mail Requests [2] => 10 [status] => 10 [3] => 1 [enabled] => 1 [4] => 10 [view_state] => 10 [5] => 10 [access_min] => 10 [6] => [file_path] => [7] => This is for incoming mails ( [description] => This is for incoming mails ( [8] => [pop3_host] => [9] => DOMAIN\RFS [pop3_user] => DOMAIN\RFS [10] => Password [pop3_pass] => Password [11] => 0 [pop3_categories] => 0 ) ) Array ( [Received] => from TESTSVR ([]) by with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id PGMJG0QS; Wed, 19 Jul 2006 11:34:03 +0200 [Message-ID] => <> [From] => TEST System [To] => [Subject] => TEST New company registration [Date] => Wed, 19 Jul 2006 11:22:30 +0200 [MIME-Version] => 1.0 [Content-Type] => text/plain; charset="iso-8859-1" [X-Mantis-Body] => New client Registration Company: edwed Contact Person: sds Telephone: 21 21 Ben3 [Priority] => 30 )

Below that i get:

User not found.
Weird indeed. This used to work perfectly before i applied the latest version.

Help please!
User avatar (0013115)
cas (reporter)
2006-07-19 08:31

We receive from time to time mails without subject and the import script stumbles over this.
this can be easlily adjusted by something like this :
if ($p_mail['Subject'] == ""){
    $p_mail['Subject'] = "No Subject found" ;
$t_bug_data->summary = $p_mail['Subject'];
if ( $t_mail_save_from ) {
    $t_bug_data->description = "Report from: ".$p_mail['From']."\n\n".$p_mail['X-Mantis-Body'];
} else {
    if ($p_mail['X-Mantis-Body'] == ""){
        $p_mail['X-Mantis-Body'] = "No Description found" ;
    $t_bug_data->description = $p_mail['X-Mantis-Body'];

where the original code was :
$t_bug_data->summary = $p_mail['Subject'];
if ( $t_mail_save_from ) {
    $t_bug_data->description = "Report from: ".$p_mail['From']."\n\n".$p_mail['X-Mantis-Body'];
} else {
    $t_bug_data->description = $p_mail['X-Mantis-Body'];

Before i forget, adjustment has to be made in mail_api.php.

Finally want to confirm the issue and fix reported by EBY (0012226) when using DISK as storage solution.

User avatar (0013117)
indy (reporter)
2006-07-19 15:18

I'll integrate this new patch and fix the errors on weekend.
I think I have a little time then.

So long...
User avatar (0013130)
bmccool (reporter)
2006-07-24 03:25

Not too sure if you've done the integration yet but if not would it possible to integrate directly with version 1.0.4. which was released over the weekend?
User avatar (0013131)
indy (reporter)
2006-07-24 04:37

Hi bmcool,

I'll do this.
But this weekend I had to create an PDF exporting tool for the MediaWiki, so I wasn't able to work on my Mantis patch.

So long...
User avatar (0013159)
dcolliervb23 (reporter)
2006-07-26 23:58

i downloaded the copy from indy's link on 7/16/2006, but when I try to click the link for managing my specific project (manage_proj_edit_page.php?project_id=1), I get the following error:

SYSTEM WARNING: main(PEAR.php): failed to open stream: No such file or directory

It looks like all necessary pear packages are in it, except for this file. Do I need to download this file from another package off

User avatar (0013160)
indy (reporter)
2006-07-27 03:12

You may use the PEAR.php from [^]
User avatar (0013171)
cas (reporter)
2006-07-31 06:42

I also can confirm BMCCOOL's comment (0013114) that when wants the user to be added if it does not exist, the latest patch acts strangely. It indeeds generates a "User not found" error.
I could tackle that by commenting the following line "auth_attempt_script_login($t_reporter);".
However strangely enough this only imports the mail the second time the script is run.
Any clue on this issue ?

User avatar (0013172)
cas (reporter)
2006-07-31 06:42
edited on: 2006-07-31 06:44

I also can confirm BMCCOOL's comment (0013114) that when one wants the user to be added if it does not exist, the latest patch acts strangely. It indeeds generates a "User not found" error.
I could tackle that by commenting the following line "auth_attempt_script_login($t_reporter);".
However strangely enough this only imports the mail the second time the script is run.
Any clue on this issue ?


User avatar (0013293)
cas (reporter)
2006-08-18 05:33

I have spotted another issue (and created the solution for it).
We had problems if a mail was received with more than one picture embedded in the body of the message.
This caused a dupicate file error since every embedded picture was attached using the same filename causing the error message.
In order to overcome this issue, we need to change two functions :

function mail_add_bug
add the end where the files are attached i included a counter to be passed to the mail_add_file routine.
# Add files
if ( null != $p_mail['X-Mantis-Parts'] ) {
       $filenr=1 ;
    foreach ($p_mail['X-Mantis-Parts'] as $part) {
        mail_add_file ( $t_bug_id, $part, $filenr );
        $filenr ++ ;

then the mail_add_file routine should be like this
# --------------------
# Very dirty: Adds a file to a bug.
function mail_add_file( $p_bug_id, $p_part,$p_filenr ) {
$GLOBALS['_mail_file_'] = $p_part['Name'];
if ( 0 < strlen($p_part['Name']) ) {
    $t_file_name = '/tmp/'.$p_part['Name'];
    file_put_contents($t_file_name, $p_part['Body']);
    $mantisname = $p_filenr;
    $mantisname .= $p_part['Name'];
    file_add($p_bug_id, $t_file_name, $mantisname , $p_part['Content-Type'], 'bug');

Hopefully this helps others too.

User avatar (0013294)
indy (reporter)
2006-08-18 07:05

Thanks to cas, I've added your patch.
User avatar (0013295)
indy (reporter)
2006-08-18 08:17


I've updated the patch for Mantis 1.0.5.

See: [^]

The mail parsing is a complete rewrite, now it should support all combinations of embedded HTML and text and also different encodings.

So long...
User avatar (0013367)
bmccool (reporter)
2006-09-12 07:03


I've recently upgraded to 1.0.5 but get the following error when i run bug_report_mail.php

[pear_error: message="Generic login error" code=1 mode=return level=notice prefix="" info=""]

This is just the portion of the error that i think is causing the error. I've never seen it before and google doesn't know much either...

Any ideas?
User avatar (0013385)
cas (reporter)
2006-09-14 10:57


i have found 2 little issues. One of the nice things of this add-on is that when a second mail arrives with the same topic, it adds it as a note to the original.
This however happens regardless of the status of the original issue. Think we need a treshold to decide to add it as a note or to create a new issue.

If you find time to look at this, could you also strip the "RE:" that outlooks adds to the subject when replying such that also those messages can be added as a note ?
User avatar (0013386)
vboctor (administrator)
2006-09-14 13:39

A lot of attachments were lost after the crash of Indy, can you please attach the latest code. I will patch this Mantis installation to show the broken attachments.
User avatar (0013407)
indy (reporter)
2006-09-17 09:14

Hi there,

the latest version of the mail import patch is available again.

It is still unchanged, I'll fix the noticed issues when I'm back from Kyrgyzstan in the middle of October.
User avatar (0013408)
achumakov (reporter)
2006-09-17 10:50

Wow, indy! What are you doing there in Kirgyzstan? Are you Russian?
User avatar (0013409)
indy (reporter)
2006-09-17 11:00

No, I'm German. ;-)
My professor asked me if I would like to hold a workshop in Java programming with him at the university in Bishkek.
User avatar (0013410)
achumakov (reporter)
2006-09-17 11:09

That's cool, anyway
User avatar (0013413)
vboctor (administrator)
2006-09-19 04:49

Hey everyone, just wanted to let you know the good news that Indy has joined the Mantis development team and we will work together in getting this feature into Mantis codebase.

The first step will be to write the requirements of the feature in the Wiki. The aim of this excercise will be to indentify any necessary changes that are required before including this in the offical codebase. Once this is done it shouldn't be a lot of work to implement the changes and get this stuff in. [^]

I would like to take this chance to thank Indy for his work so far and looking forward to work closely with him once he gets back from his business trip.
User avatar (0013595)
thoben (reporter)
2006-10-09 12:40

I'm just testing this nice feature under Windows. I had some difficulties with attachments because of the hard-coded '/tmp' in the mail_add_file-function.
I changed it to use the mail_tmp_directory-parameter:
function mail_add_file( $p_bug_id, $p_part, $number ) {
    $t_mail_tmp_directory = config_get( 'mail_tmp_directory' );
    $GLOBALS['_mail_file_'] = $p_part['name'];
    if ( 0 < strlen($p_part['name']) ) {
        $t_file_name = $t_mail_tmp_directory.$p_part['name'];
        file_put_contents($t_file_name, $p_part['body']);
        file_add($p_bug_id, $t_file_name, $number."-".$p_part['name'], $p_part['ctype'], 'bug');
User avatar (0013622)
cas (reporter)
2006-10-18 10:36
edited on: 2006-10-18 10:55


i notice different behavior if i run the bug_report_mail.php script through a commandline. Amongst other things, retrieving the reporter id seems to fail. If i run the script through the browser all works fine.
Is this a known issue and if so, is a fix available and/or known ?

User avatar (0013712)
vJack (reporter)
2006-11-10 03:19

This is a fantastic feature I'm really hoping to use, but I've hit an error.

When I go to Manage/Manage Projects/'specific project' (manage_proj_edit_page.php) I get the following error:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /mantis/Mail/Parser.php on line 7

I made a complete new install using the 1.0.5 package from Indy's site: [^]

All the files and db tables apear to be in place, and the rest of Mantis functions fine. Any ideas?
User avatar (0013726)
rellg (reporter)
2006-11-16 05:29


I need some help!

At here we use utf-8 for mail encoding. This is not too nice in mantis when I report a bug by mail.
It doesn't use the right characters.
Can somebody help me?
User avatar (0013738)
DTGI (reporter)
2006-11-19 05:45


I had the same problem. The cause is the Parser.php. The php scripts in this file are wrote to support only PHP version 5.x. So when I tried to make it work on my PHP 4.x hosting, it resulted in similar errors.

Somehow the code should be refactored to support both versions PHP 4.x and 5.x, I guess.
User avatar (0013779)
bmccool (reporter)
2006-12-07 01:53

wrt my post (0013367)

Anybody have any ideas how i can get past the "generic login error" when i run bug_report_mail.php?
User avatar (0013803)
jnak (reporter)
2006-12-11 19:13

hi everyone I'm trying to get this nifty feature working in windows. so far I'm not getting any errors but I'm unsure of a couple things. Is the 'mail' user that needs to be set up the address that we would be sending e-mails to to report a bug via e-mail? and also is opening bug_report_mail.php from the web browser the proper way to retrieve the e-mails for entry into reporting the bug?
User avatar (0013805)
vboctor (administrator)
2006-12-12 02:20

The Mail\Parser.php uses the new format specifiers which are not supported by PHP 4.x. Hence, this will not work on the PHP servers running on most of the Mantis installations out there and won't be compliant with Mantis current minimum requirements.

I got it passing the syntax check, but haven't tested it, by removing the following:

- Replace "private " with "var " for variables.
- Replace "__constructor" with the class name.
- Replace "public " with nothing.

It would be great if we can use an older version of this module which supports 4.x. In the worst case, we should avoid including these files if the installed version of PHP is 4.x.
User avatar (0013808)
indy (reporter)
2006-12-12 07:07

The Mail_Parser class is written by me.
I'll make it PHP 4.x compatible before commiting it into CVS.

Sorry, I have no more PHP 4.x installations running... ;-)
User avatar (0013822)
jnak (reporter)
2006-12-13 15:36

what syntax must e-mails follow to be parsed properly for reporting issues?
User avatar (0013829)
jnak (reporter)
2006-12-14 18:19

Is my understanding of this correct? After installation of the patch you go to manage project accounts and add a user/email address and set up a reporter account? and set it up for the current category of the project? upon running bug_report_mail no errors get generated and nothing changes in the database even when I try to get it to be more verbose. Is there something glaringly obvious that I'm missing? any assistance would be appreciated.
User avatar (0013854)
EBY (reporter)
2006-12-20 19:22
edited on: 2006-12-21 10:00

Small issue with your debug mode... emails are always saved to file to my temporary folder even if debug is off. Looks like you do not check if the debug mode is ON or OFF in the mail_save_message_to_file function, despite the fact that you retrieve the config param value.

I moved the call to the mail_save_message_to_file function in mail_process_all_mails like this:


function mail_process_all_mails( &$p_account ) {
  $t_mail_debug = config_get( 'mail_debug' );
  $t_mail_fetch_max = config_get( 'mail_fetch_max' );


if ( $t_mail_debug ) {
mail_save_message_to_file( $t_msg );

#mail_save_message_to_file( $t_msg );
mail_add_bug( $t_mail, $p_account );


User avatar (0013941)
RyanR (reporter)
2007-01-21 22:01

Does anyone have a patch for this feature based on 1.1.0a2?
User avatar (0013943)
indy (reporter)
2007-01-22 00:45

Sorry, there is no newer patch at the moment.
I'm in Uganda until march and it is not possible here to work on it.

I'm sorry. When I'm back in Germany, the development of my patch will continue.
User avatar (0013959)
redcom (reporter)
2007-01-24 16:08

Is there a reason this has not been committed to the development tree to officially supported, instead of having to patch every release?
User avatar (0013961)
indy (reporter)
2007-01-25 00:27

Victor gave me already CVS access, but I was not able to commit the patch into the offical Mantis sourcecode.

I was very busy the last months.
User avatar (0014004)
dapozzom (reporter)
2007-02-05 10:24

Where I can findout all the modules updated for 1.1.0a1
User avatar (0014088)
drtns (reporter)
2007-02-23 12:56

I would just like a quick confirm, that the 1.0.5 patch works for 1.0.6??
User avatar (0014117)
Jimmy (reporter)
2007-02-28 10:09

Same question:

I would just like a quick confirm, that the 1.0.5 patch works for 1.0.6??
User avatar (0014255)
EBY (reporter)
2007-03-27 14:33

A small problem I noticed and for which I am trying to find a solution:

If you forward the same email to Mantis twice (or different emails with same attachments names and order) to add a bug note to an existing bug... then on the second email, the system will add the new bug note but when it tries to add the attachment it will fail and result in a "duplicate file" error.

Although this mod adds a prefix (1-, 2-, 3-, etc.) to each attachment in the same email, it will have problems when subsequent emails for the same bug have the same attachments names and in the same order.

As a result, the email is parsed into the existing bug note, the attachments dont make it and the email is left in the mailbox after the error is triggered. This means that on the next email fetch, the email is still parsed and bug note added again and failure on attachment (duplicate file name in database) will again leave the email in the mailbox... repeating over and over... with email notification going out non stop each time the email is parsed again. You get the picture.

I am trying to find a solution for this: deleting the email prior to this attachment parsing is a quick fix but not intuitive to users as their attachments are just dropped. Ideally, a way to number attachments globally would work... if at the time where the system starts numbering attachments for a new email, it 1st fetched the max attachment prefix number for the current bug. More work.
User avatar (0014256)
EBY (reporter)
2007-03-27 15:09

I made a quick and dirty fix for the problem I just reported:

I do not use the attachment numbering code found in mail_api.php, I could take out the numbering completely but decided to just comment out where it added when passed to the file_add code:

#EBY 20070327 - bug with prefix
# file_add($p_bug_id, $t_file_name, $number."-".$p_part['name'], $p_part['ctype'], 'bug');
            file_add($p_bug_id, $t_file_name, $p_part['name'], $p_part['ctype'], 'bug');

Instead when it comes time to check for the unicity of the new attachment file name in the database, I replaced the check as follows:

#EBY 20070327 - fix duplicate attachment issue
        $number = 1;
        while (!file_is_name_unique( $number . '-' . $p_file_name, $p_bug_id ) )
        $p_file_name = $number . '-' . $p_file_name;

# if ( !file_is_name_unique( $p_file_name, $p_bug_id ) ) {
# trigger_error( ERROR_DUPLICATE_FILE, ERROR );
# }

This works great and if I forward more copies of the same file in different emails they all get added with a different unique prefix. Not a very elegant solution (dont like that kind of loop) but it does the job for now!
User avatar (0014257)
EBY (reporter)
2007-03-27 15:44

Regarding the 1.0.5 patch for Email on release 1.0.6... I got mine to work although I did have some problems that required minor edits. I don't think the problems I encountered were related to the patch being made for 1.0.5 but rather just small bugs that caused minor issues on my specific setup.
User avatar (0014370)
jboulay (reporter)
2007-04-19 16:31

Hi everybody,

it's a very nice stuff !!

I've developped the following evolutions on the mail reporter functionnality:
- parsing mail body for specific fields
- batch file for use with a cron tab
- update to Mantis 1.0.6

you will find a complete 1.0.6 distribution on [^]
User avatar (0014445)
dapozzom (reporter)
2007-05-08 10:53

The zip file seems to be corrupted
User avatar (0014488)
sirshurf (reporter)
2007-05-10 03:58

Will there be a version for the 1.1* ????
User avatar (0014490)
indy (reporter)
2007-05-10 07:12

Yes it will, when I find enough time to work on it again.
User avatar (0014498)
sirshurf (reporter)
2007-05-11 04:23

Maybe somebody else can do the integration if you dont have the time... (I can look at it if you like...)
User avatar (0014650)
jotango (reporter)
2007-05-29 10:50

I would love the email format to be compatible with the bugzilla format: [^]

Some thought has gone in to the Bugzilla format, I think it would be a good idea to learn from their experience. Plus compatability makes it easier for people to switch to Mantis.
User avatar (0014688)
SL-Gundam (reporter)
2007-06-06 11:50

I was in need of this feature for Mantis 1.1.0a3.

This is the result. It's based on mantis-1.0.5.patch.gz

Jun 2007
    - update to Mantis 1.1.0a3
    - Support for PHP 4 ( 0004286:0013805 )
    - Fixed a bug with processing priority's of emails (priority class variable didn't exist in Mail/Parser.php)
    - Updates to the latest PEAR packages
    - print_r changed to var_dump's (Works better if you have xdebug extension installed)
    - New config setting called:
        # Default bug category for mail reported bugs (Defaults to "default_bug_category")
        # Because in Mantis 1.1.0a3 a category is required, we need a default category for issues reported by email.
        # Make sure the category exists and it has been configured correctly
        $g_mail_default_bug_category = '%default_bug_category%';
    - Fixed a missing variable in the function: "mail_process_all_mails"
        $t_mail_debug was not set and would cause notice level errors and debug mode in this function wouldn't work ( 0004286:0013854 )
    - Emails are now not allways saved to disk ( 0004286:0013854 )
    - Made sure $t_mail['X-Mantis-Complete'] would allways be populated ( with null value if the config "mail_additional" was disabled )
    - Adding attachments to bug items now also works on Windows systems (Removed hardcoded directory part "/tmp/").
    - The subject of an email is now also trimmed before storing it in $t_bug_data->summary. Like it is in bug_report.php
    - Fixed problem with duplicate attachments ( 0004286:0014255 and 0004286:0014256 )
User avatar (0014691)
SL-Gundam (reporter)
2007-06-06 13:45

I forgot to terminate a line in mail_api.php. ( "" )

My apologies for that.

I added the package again with the correction in it ( "" )

Can somebody remove "". I can't do it myself.
User avatar (0014715)
reszel (reporter)
2007-06-08 12:59

How to apply a patch?

Step by step instructions for for reporting via E-Mail patch?

I'm running mantis-1.1.0a3 on a shared host.
I've downloaded "mantis-1.0.5.patch.gz" and ""

1) I don't know how to apply the patch :=( HELP!

2) After paching, files in """ should be copied
    over older files installed by the patch.

3) I assume that i have to configure an e-mail forwarder for "" like this:
    | /usr/local/bin/php -q /home/domain/public_html/mantis/bug_report_mail.php

Correct me if I'm wrong.
User avatar (0014716)
reszel (reporter)
2007-06-08 13:02

How to apply a patch???
My step by step instructions for for reporting via E-Mail patch:

I'm running mantis-1.1.0a3 on a shared host.
I've downloaded "mantis-1.0.5.patch.gz" and ""

1) I don't know how to apply the patch :=( HELP!

2) After paching, files in """
should be copied over older files installed by the patch.

3) I assume that i have to configure an e-mail forwarder for "" like this:
    | /usr/local/bin/php -q /home/domain/public_html/mantis/bug_report_mail.php

Correct me if I'm wrong.
User avatar (0014718)
SL-Gundam (reporter)
2007-06-08 20:09

I discovered one last small problem that could occur. So thats fixed in

Because this was the second problem which required patching i tested all the changes. I couldn't find anymore problems.
User avatar (0014719)
SL-Gundam (reporter)
2007-06-08 20:17

Copy all files from to the root of your mantis installation overriding all existing files.

In the /docs/ directory you'll find 2 files called:
bug_report_mail.sql - Contains all the needed database changes.
README.bug_report_mail - Contains general information on a number of the settings you can set.

After the script has been succesfully installed you can log into the admin account. Go to "Manage projects" page. Click on a project. At the bottom of the page you'll find a form to activate email retrieval for that project.

Hope this helps
User avatar (0014743)
jhofker (reporter)
2007-06-11 11:16

Hi Indy,
First, great plugin.

I have a couple of things that I think could improve this even more:
1) The email password box should be an actual password box. Displaying passwords cleartext like that could be a security issue.
2) Default category specification should probably be specified per project. Maybe I just don't use Mantis correctly, though. :-) Is the best way to add the same category to every project (ie, "Email Reported Bugs")?

Keep up the great work!
User avatar (0014809)
davide73italy (reporter)
2007-06-25 08:59

Why isn't this in CVS branch??
User avatar (0014810)
davide73italy (reporter)
2007-06-25 09:00

Why isn't this in CVS branch??
User avatar (0014811)
bmccool (reporter)
2007-06-25 09:45

See note 0013961 davide73italy ;)
User avatar (0014892)
DaVinci (reporter)
2007-07-06 16:24

i still dont get how do i activate the reporting by mail...
when i go to Manage Project and click on a Project and then go the bottom of the page im asked to type in POP3 settings..
which settings are the these?
what do i write there?
User avatar (0014998)
axeljung (reporter)
2007-07-15 18:30

If a email Report via Email with attachments recieved.
this Line throws an Error:

Line 466 in mail_api.php

while( !file_is_name_unique( $number . '-' . $p_file_name, $p_bug_id ) ) {

it have to be:

while( !file_is_name_unique( $number . '-' . $part['name'], $t_bug_id ) ) {
User avatar (0015000)
axeljung (reporter)
2007-07-15 18:32

If a email Report via Email with attachments recieved.
this Line throws an Error:

Line 466 in mail_api.php

while( !file_is_name_unique( $number . '-' . $p_file_name, $p_bug_id ) ) {

it have to be:

while( !file_is_name_unique( $number . '-' . $part['name'], $t_bug_id ) ) {
User avatar (0015036)
DaVinci (reporter)
2007-07-16 04:58

can someone please help me..i have been waiting for many days now

i still dont get how do i activate the reporting by mail...
when i go to Manage Project and click on a Project and then go the bottom of the page im asked to type in POP3 settings..
which settings are the these?
what do i write there?
User avatar (0015037)
jboulay (reporter)
2007-07-16 05:20

Hi DaVinci,

In the POP3 settings fields, you must type the POP3 connexion parameters.
This will allow you to connect to your mail server and get all the emails processed by the mantis bug reporter extension.

POP3 Host : your mail server
POP3 User : the email account that will receive mail notifications
POP3 Password : the password of this user

Once your pop mail server is configured, you can also configure some parameters in the configuration file

In order to execute the automatic reporter, you have to go on page
http://your_mantis_server/bug_report_mail.php [^]

I hope this will help you ...
User avatar (0015039)
DaVinci (reporter)
2007-07-16 06:44

thanxx for the reply..
i get the follwoing error message when i try to go to the above link:

error:<db_username> [pear_error: message="-ERR authorization failed" code=-1 mode=return level=notice prefix="" info=""] [pear_error: message="Generic login error" code=1 mode=return level=notice prefix="" info=""]
User avatar (0015041)
DaVinci (reporter)
2007-07-16 07:10

im am the administrator an yet i get the error above
User avatar (0015043)
jboulay (reporter)
2007-07-16 08:51

It seems that your connection parameters are wrong !!

Try to enter the user account only : "helpdesk", without the complete email adress. It should work !

Could you also give me the version of the mail reporter extension you use ?
User avatar (0015044)
DaVinci (reporter)
2007-07-16 10:47
edited on: 2007-07-16 10:49

im using:
 mantis-1.0.5.patch.gz [^] (109,299 bytes) 2006-09-17 09:09

and i appereciate ur help but i do not understand what do u mean
i get the above error message when i go to:

http://your_mantis_server/bug_report_mail.php [^]

This is what i want to do: [^]

User avatar (0015166)
Banek (reporter)
2007-07-23 02:35

Thank you for great patch! :-)

it makes issue and notes for existed issues by email. But it don't create notifications to email reporter via email even with "creating new accounts" option enabled.

I'm using mantis 1.0.5 with mantis-1.0.5.patch.gz
User avatar (0015178)
juan777 (reporter)
2007-07-23 07:58

Ummm... First of all, thanks to all for that huge and great work.

Second, I have configured this patch ok and I can report issues via web OK including spanish caracters like ñ, á,é,í .. etc...

But using mail reporter plug-in I can report issues via email IF NOT contain these spanish caracters... if contain it i get this error:

How can solve it????????????????Please.

Database query failed. Error received from database was 0001366: Incorrect string value: '\xE1\x0D\x0A\x0D\x0AJ...' for column 'description' at row 1 for the query: INSERT INTO mantis_bug_text_table
( description, steps_to_reproduce, additional_information )
( 'Report from: \"Juan\" \n\n poᜲ\n\r\nJuan +34945392080,\r\n\r\n\r\n\r\n', '',
'' )
Many thanks in advance.
User avatar (0015530)
eagle00789 (reporter)
2007-08-25 09:05

After a lot of work making it work for 1.0.8, i finally have it working. Thanks for such a great patch, but i would love to see this new feature in the upcoming 1.1.0 version!
User avatar (0015531)
eagle00789 (reporter)
2007-08-25 11:14

Please add the following line to the file mimeDecode.php to prevent adding of e-mail certificates (to verify that the mail is from me) as an attachment to a bug. This line needs to be added around line 292 in the function _decode in the above mentioned file.
case 'application/x-pkcs7-signature': //E-Mail Certificate
User avatar (0015554)
cas (reporter)
2007-08-30 05:58

Found another small issue. If an email is retrieved with an attachment but no body text, the bug/issue is created but the attachment is not added.
It looks like something fails within the parser.
Anyone an idea ?
User avatar (0015833)
Banek (reporter)
2007-10-09 04:43

can you share your knowledge how you make it work for 1.0.8?
User avatar (0016038)
Woefdram (reporter)
2007-10-31 11:22

I've played with this for a while and would love to see this accepted into the Mantis sourcecode. Very useful patch, this...
User avatar (0016077)
tronics (reporter)
2007-11-04 12:44

Please add this one to the project!
This is a great and very needed addition.
User avatar (0016079)
tronics (reporter)
2007-11-04 12:54

Please add this one to the project!
This is a great and very needed addition.
User avatar (0016109)
indy (reporter)
2007-11-08 06:05

I've been abroad for a while, but now I'm back.
The weekend I'll build a new version of the patch for the current stable and development release of Mantis.

So long...

User avatar (0016115)
brody (reporter)
2007-11-08 10:33

Hi Gerrit,
you wrote : " version of the patch for the current stable and development release". Will this be two patches (stable, development) or is this one patch for the current rc2?

I ask, because I'm on the way to integrate this great patch into my prod version 1.0.7 (which also works for 1.0.8)
User avatar (0016128)
cz4hkr (reporter)
2007-11-09 13:14

Hi all,
Please how can I reopen closed or resolved bug through email??
I set g_reopen_bug_threshold , but this is only for web interface.

thanks in advance
User avatar (0016246)
cas (reporter)
2007-11-20 02:32
edited on: 2007-11-20 02:33

Have a small update on the mail_api.php.
In case one runs 2 instances of Mantis both using this feature, you may end up having the issue that a mail is recognized to be a bugnote. But that the bug cannot be found due to the fact that it is part of another instance.
To avoid this issue the function "mail_is_a_bugnote" needed to be adjusted like :
# --------------------
# return true if there is a valid mantis bug referernce in subject
function mail_is_a_bugnote ( $p_mail_subject ) {
if (preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{1,7})\]/", $p_mail_subject)){
    $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] );
    if ( bug_exists( $t_bug_id ) ) {
        return true;
    } else{
        return false;
    return false;
// return preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{1,7})\]/", $p_mail_subject);

Perhaps this can be included in the next version.


User avatar (0016317)
nawak (reporter)
2007-11-28 03:19

I have a problem when I forward mail, it doesn't seem to accept .eml files and, at this line (551) in file_api :
 $t_file_size = filesize( $p_tmp_file );
the value of $t_file_size is 0 even if it's not the case ... so I got the following error : ERROR_FILE_NO_UPLOAD_FAILURE ...
Does someone know where does it come from please ?

Thanks in advance.
User avatar (0016417)
Loki (reporter)
2007-12-09 13:55

jboulay in note(0014370) you have a bat file to run the mail call function. I have a test instance of Mantis on Windows XP and I changed the paths in the batch file to match my setup and it works. I've a production version on Windows 2000 server and I can't get the batch file to work. I'm stuck. Do you know what I need to change to have it work on Windows 2000 server?

Thank You
User avatar (0016526)
Woefdram (reporter)
2008-01-02 08:01

Any news about this patch and its availability for 1.1.0?
User avatar (0016544)
libregeek (reporter)
2008-01-04 02:15

I tried to integrate this patch to mantis-1.1.0 and got the following error:
APPLICATION WARNING #100: Configuration option 'db_schema' not found.


Page redirection error, ensure that there are no spaces outside the PHP block (<?php ?>) in config_inc.php or custom_*.php files.

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

I have checked the config files and the custom files and it doesn't have any spaces outside php block.

Any solution for the above problem?
User avatar (0016548)
libregeek (reporter)
2008-01-04 03:35
edited on: 2008-01-04 03:37

I have managed to setup the plugin in mantis-1.1.0. The issues was with config_defaults_inc.php and I used the new config_defaults_inc.php and added the additional config parameters for mail_report.

However I am unable to create bug from email. I am using a secure POP3 server and have hacked core/mail_api.php to modify the POP3 port to 995.

Is there any way out to fix the issue with secure POP3 server?

User avatar (0016809)
scubie (reporter)
2008-01-25 01:47

I have downloaded and installed 1.1.1, is this issue built in to this new version or do I still need to download and apply this patch?
User avatar (0016810)
brody (reporter)
2008-01-25 03:24

as you could see above in field "target version" (maybe you have to switch to 'advanced view' of issue), currently this very important feature (my weighting!) will be part of V1.2.0

A longer time ago it was moved from 1.1.0 to 1.2.0, unfortunately.
User avatar (0016822)
scubie (reporter)
2008-01-26 00:31

Thanks brody - still learning to use the system, important lesson learned!
User avatar (0016868)
strangeways (reporter)
2008-01-28 19:43


In addition to changing the port to 995, add ssl:// before the mail server. E.g., ssl:// [^]

Once I did that, I was able to connect to a secure POP3 server and retrieve the mails.


This may also have been the cause of your "Generic login error" error message.
User avatar (0016894)
strangeways (reporter)
2008-01-30 21:36

Just a couple notes:

1. The latest package of changed files ( needs to include the updated core/category_api.php (otherwise Mail Account per Category won't work, because the SELECT statements won't retrieve the mail account fields). Also, as libregeek mentioned above, config_defaults_inc.php needs to be updated to include the new Mantis configuration options.

2. I noticed that if the email is HTML, the attachment doesn't get added to the bug that is created. If the email is text, however, the attachment gets added. Any ideas on how to fix this?

Thanks for the work you've been putting into this, Indy. It's an important feature!
User avatar (0016895)
brody (reporter)
2008-01-31 04:18

regarding question 2: seems to be a bug in the parser.php. I did a fix into my own installation (on windows) with following behaviour:
a) If mail(body) is text/html, either is used as body (and not as an attachment). The latter one has to go through the (optional) htmlparser for the text only.
b) a slighly different call to the html-parser (replaced) for windows installations
c) Other text attachments (real attachment) are added as attachments.

My working copy is on V1.0.7; if you or anyone else is interested, I'd post the fixed file to this thread
User avatar (0016930)
strangeways (reporter)
2008-02-03 18:19

Hi Brody,

Thanks for the information! I would be interested in seeing the changes you have made to parser.php.

My working copy is V1.1.0, but I'm trying to put together a package of changed files for V1.1.1. Perhaps I could incorporate the bug fix into that and then post the new package here.
User avatar (0016932)
brody (reporter)
2008-02-04 05:17


I hope that its enough to only attach the mentioned file "parser.php". May changes are commented with (brody). If you have questions, contact me...
User avatar (0016949)
strangeways (reporter)
2008-02-04 20:59

Thanks Brody! This was very helpful. I ended up including both html parser commands and put an operating system check to run the correct version. I also ended up rewriting the setParts function and made sure to check for the disposition attribute on each part.

I've put together an UNOFFICIAL package for V1.1.1 and attached it to this issue. The changes are listed below:

1. Patched Mantis files now include 1.1.1 changes.

2. Includes updated category_api.php with the correct SQL queries.

3. Added changes based on brody's Parser.php patch:
    a. Support for loading an HTML parser on Windows. OS is auto-detected (if not Windows, defaults to original piped command form).
    b. Rewrote setParts() function - function was only loading the first part (and any sub-parts of the first part). Now goes through all parts and sub-parts.
        - Checks for "disposition" attribute on each part. If set, the part is considered an attachment.
        - If the body is split across multiple sub-parts of a "multipart" part, will now concatenate them together before setting the body.
        - If an HTML part should be included as an attachment (like in the original version of the function), there are a few lines that can be uncommented. Warning: This change has not been tested yet, but it should work the same as before.

4. In file_api.php, included EBY's changes mentioned in note #0012226:
    a. move_uploaded_file() changed to rename()

5. In mail_api.php:
    a. mail_add_file() now uses the mail_tmp_directory configuration option for writing the temporary file.
    b. mail_add_file() now doesn't try to unlink a temporary file if method is DISK. Since file_add() moves the temporary file to its final location for the DISK method, the original temporary file is not there afterwards. (Why does the file_add() function also try to move files for the FTP method?)

As stated above, this package is unofficial. It also needs testing. Indy, feel free to include any of these changes in an official packaging.

Something else I'd like to do at some point is add a checkbox next to the POP3 Host field to indicate a secure POP3 server. This would automatically add ssl:// to the beginning of the mail server string, and also change the port from 110 to 995.
User avatar (0016951)
strangeways (reporter)
2008-02-04 22:11

Just uploaded a new package: Mantis-1.1.1-changed_files_only-unofficial-v1.tgz

There was a bug in the setParts function that was causing the content to appear to be duplicated when there was no attachment. My apologies. I've fixed it to only concatenate the content when it is in sub-parts. The previous package can be deleted.
User avatar (0016968)
brody (reporter)
2008-02-06 10:53

only one remark to last statement at 3.b "Rewrote setParts()...

Although I did not take a look into your changes, but your assumption isn't that correct, I think. I got all parts as attachment including that meant as body.

Using a debug session I first found out that setParts() got called recursivly to get sub parts and uses all parts in its last loop. Second the "disposition" test came to check between text body part(s) and text attachment. All attachments (with disposition set) should be handled as attachments (addParts)

Regarding the htmlparser - my version is a java class around jericho-html.jar, which also could be used under linux. Because the html parser could be configured inside the configuration (I'm right?) it would make more sense to support a "flying file" parameter, which tells, where the file should be included. Thus you'd get in either case as shell_exec ($html_parser) and inside configuration
a) for linux: cat ${f} | /usr/bin/w3m -T text/html -dump
and e.g.
b) on windows: htmlparser\parse.bat ${f}
User avatar (0017004)
Woefdram (reporter)
2008-02-11 05:53

Great, it works. Thanks!

I think I found something though. If I configure Mantis to pick up 5 messages at a time, it doen't seem to call the "QUIT" command. Without the "QUIT" command, our GroupWise server doesn't delete messages, although I see Mantis send the "DELE" command.

If I make $g_mail_fetch_max 1, everything works just fine and messages are picked up, processed and deleted from the mailserver.
User avatar (0017011)
brody (reporter)
2008-02-11 11:29

Just wanted to provide another patch here - but that failed without an error message.

This patch circumvents the problem (i have currently), if one can't delete mails on a pop3 account for some reasons. Thus you would set "g_mail_delete" to OFF. Side effect: On every call of the php script you duplicate your issues. I extended the mail_api.php to check, if an e-mail of an account (of a project) is newer than the last checked mail and only add newer mails. Last saving the datestamp of the last added mail, so only then again newer mails are filled in.
User avatar (0017012)
brody (reporter)
2008-02-11 11:31
edited on: 2008-02-12 05:10

Second try - it did :-) see last attached file (mail_api.php.patch-v2)

User avatar (0017019)
dapozzom (reporter)
2008-02-12 07:30

I cannot get the email attachment to be added to my issue and for the description always “No description found”
My config_inc settings are
$g_mail_use_reporter = ON;
    $g_mail_reporter = "CAU";
    $g_mail_auto_signup = OFF;
    $g_mail_debug = OFF;
    $g_mail_additional = OFF;
    $g_mail_save_from = ON;
    $g_mail_parse_mime = OFF;
    $g_mail_parse_html = OFF;
    $g_mail_bug_priority_defult= NORMAL;
    $g_mail_bug_priority= NORMAL;
    $g_mail_html_parser = OFF; # '/usr/bin/w3m -t text/html -dump';
    $g_mail_tmp_directory = OFF;
    $g_mail_fetch_max = 1;
    $g_mail_auth_method = 'USER';
    $g_mail_use_bug_priority = ON;
    $g_mail_default_bug_category = 'CAU - Centro Assistenza Utenti';
    $g_mail_directory = './Mail_CAU';
    $g_mail_from = './Mail_CAU';
    $g_mail_tmp_directory = './Mail_CAU';
User avatar (0017037)
dapozzom (reporter)
2008-02-13 04:52

I attached the debug file
User avatar (0017039)
brody (reporter)
2008-02-13 12:29

Thanks for the debugfile - this file is a Mime-Mail (in my opinion), thus you need to switch at least $g_mail_parse_mime to ON.

Besides that, there is a typo in your configuration I guess:
$g_mail_bug_priority_defult -> $g_mail_bug_priority_default
User avatar (0017043)
lleroy (reporter)
2008-02-14 09:18

hi, i added a few lines of code to set the category and severity from the email message when reporting a new bug.

--- mail_api.php-orig 2008-02-14 15:07:51.863103100 +0100
+++ mail_api.php 2008-02-14 15:01:43.522902800 +0100
@@ -426,13 +426,23 @@
                $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 );
                $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );

+ if (preg_match("/^\s*@?[Cc]ategory\s*[:=]\s*(.*)/", $p_mail['X-Mantis-Body'], $matches)) {
+ $t_bug_data->category = $matches[1];
+ } else {
                if ( isset( $p_account['category'] ) && $p_account['category']) {
                        $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] );
                } else {
                        $t_bug_data->category = gpc_get_string( 'category', config_get( 'mail_default_bug_category' ) );
+ }
                $t_bug_data->reproducibility = 10;
+ if (preg_match("/^\s*@?[Ss]everity\s*[:=]\s*(.*)/", $p_mail['X-Mantis-Body'], $matches)) {
+ $t_bug_data->severity = $matches[1];
+ } else {
                $t_bug_data->severity = 50;
+ }
                $t_bug_data->priority = $p_mail['Priority'];
                $t_bug_data->summary = trim( $p_mail['Subject'] );
User avatar (0017044)
Woefdram (reporter)
2008-02-14 10:02

I run it with $g_mail_fetch_max set to 1 and a cronjob that fetches mail every minute. Should work fine as long as there aren't any e-mail bursts.
User avatar (0017046)
Woefdram (reporter)
2008-02-14 11:24

Hmm, found something else. This one is nasty...

If I report anything via e-mail, the URL Mantis puts in the confirmation e-mail is screwed up. My URL is rewritten to [^] (yup, mind the period before the slash).

I know the domain is mentioned in the default config, but in my config it's gone. I searched through the program files, but couldn't find anything suspicious. Ok, I'm not a programmer...

If I do something with an issue in Mantis itself, everything's fine. But as soon as I interact with Mantis through e-mail, the URL gets whacked.
User avatar (0017050)
brody (reporter)
2008-02-15 06:47

One advice on the added POP3 ability, which works on my system. Therein the database is changed and a new user is added to the user base. The user per default has nomail@localhost as user, but of not acknowlegable default email settings, set additional a preference record with all e-mail traffic for that user is switched off. Furthermore it might be useful, to protect that user against deleting and changing
User avatar (0017053)
brody (reporter)
2008-02-15 08:59

@Woefdram,0004286:0017046: You right, this seems to be a bug, maybe a not initialized variable, my disturbed URL is more crashed compared to another manually added issue, which says (e.g.):
http://localhost:8899/view.php?id=180 [^]

by Mail Reporter, the URL is{absolute [^] path of installation or runtime}/view.php?id=179

I guess, that has to do with the fact, that the Mail Reporter is run directly with php.exe, while the other is run through the webserver
User avatar (0017111)
Loki (reporter)
2008-02-19 14:08

Using the Mantis-1.1.1-changed_files_only-unofficial-v1.tgz I'm having a problem with the description not being added. I have the mail patch running in mantis 1.0.6 and have the config file with Parse MIME = ON and the description is included. But on the 1.1.1 version with the Parse MIME = ON get the error no description found. I can look at the file from the debug and it has the description. I'm running on Windows 2000 Server.
User avatar (0017113)
Loki (reporter)
2008-02-19 15:08

To fix the URL in the email just add the path to your Mantis installation in the config_inc.php file or added it in the Configuration section in Mantis.

Works for me :-)
User avatar (0017145)
brody (reporter)
2008-02-21 10:39

@Loki: What did you configure there - Would you tell us?

I instead changed, made some translations (i.e. de, en) to circumvent this problem with a correct message in the e-mail.

I'll attach adequate patches including those for the above mentioned languages
User avatar (0017147)
Loki (reporter)
2008-02-21 13:44


In the config_inc.php
$g_path = 'http://your_url/mantis/'; [^]

or in the configuration Mantis version 1.1.1
Username = All Users
Project Name = All Projects
Configuration Option = path
Type = string
Value = http://your_url/mantis/ [^]
User avatar (0017197)
Loki (reporter)
2008-02-25 16:17

Using the Mantis-1.1.1-changed_files_only-unofficial-v1.tgz I'm having a problem with the description not being added.

The Description is included if the email format is Plain text. Parse MIME = ON
But if the email is in Rich text or HTML format I get this in the description field - "no description found"

I've turn on:
Parse HTML = ON but still have no description.

This setting I don't understand for WINDOWS 2000 Server. How would I set this the example is not for Windows
# HTML Parser Command
    # It should print the formatted text to STDOUT
    # For example: "/usr/bin/w3m -T text/html -dump"
    $g_mail_html_parser = ON;

Any help would be Great!
User avatar (0017202)
brody (reporter)
2008-02-26 04:33

@Loki: The by default mentioned HTTP-Parser is a plain linux tool and the execution command is also unix like. I needed to change several lines in the mantis software to integrate such an html-parser on windows. Please take a look at my note 0004286:0016968 and strangeways' notes below. The unofficial patch should prepare to use a html-parser also under windows, as strangeways wrote.
User avatar (0017207)
Woefdram (reporter)
2008-02-27 10:29

@Loki: Thanks for the tip. I put my Mantis URL in $g_path and now the links Mantis generates are correct.
User avatar (0017210)
Loki (reporter)
2008-02-27 18:38

@Woefdram: Welcome.

@brody: I read the notes and from what is said in them the 1.1.1 should only need these 2 config settings:
$g_mail_parse_html = ON;
$g_mail_html_parser = ON;

This is how they are set but I still get 'no description found' in the description in Mantis.

If this setting htmlparser\parse.bat ${f} needs to be added I'm not sure where it goes.

User avatar (0017216)
brody (reporter)
2008-02-28 04:06

these settings (as only change) are valid on linux (or other unixes/unices?), because they come with a lot of command line tools, windows does not have and deliver.
Thus, on windows you additionally need to select a tool. I integrated jericho-html (which is java based), and is a sourceforge-project to get same functionallity as on unix. Therfore I wrote a wrapper batch around it and replaced the unix-like commandline with htmlparser\parse.bat , while the parser is linked (as in unix) into my mantis installation

@strangeway: Because I think there are a lot of users, who are running mantis on windows, might it be interesting to generally and as an option to the plain linux variant integrate my solution into the next release bundle? I think, that Java will be available on most OSes including Linux and Windows.
User avatar (0017222)
Loki (reporter)
2008-02-29 12:00

@brody: Thanks for the clarification on why the html is not working. I have Mantis 1.0.6 using the mail import and it imports the description when the email is in HTML. So I'm confused as to why that works on the same server that I have the test version 1.1.1 on?

I'm going to hold off upgrading the production code from 1.0.6 to 1.1.x until I've tested a html parser (jericho-html).
User avatar (0017252)
brody (reporter)
2008-03-03 09:57
edited on: 2008-03-12 09:32

Loki, that is indeed interesting - I'm using V1.0.7 with pop3-email extension on Windows, but not V1.1.1; maybe strangeways could help around V1.1.1 and its differing behaviour concerning the html parser on Windows. The original pop3-email extension is from V1.0.5, but there was no html-parser inside (except the configuration for unix OSes). What is your e-mail backend? Some of them deliver html emails in both html and text. The parser (of 1.1.1) has been changed by strangeways with parts of my code as written in that note below. I tested it thoroughly on my environment. If you would send me such an email, which works on V1.0.6 and not on V1.1.1, I could take a look on it.

I've again read your 0004286:0017210 and maybe found a hint to your problem. You wrote about two settings and what they are in your configuration, if I'm right. While the first one seems to be correct (its a switch), the second one is no switch, but the commandline to call and this one I've set to "htmlparser\parse.bat". Please take in mind that my setting assume a slightly other kind of calling mechanism as with unix, but strangeway should have adapted it in V1.1.1

User avatar (0017323)
brody (reporter)
2008-03-12 09:36

@Indy: Thanks again for providing the pop3 patch. A question: Do you have an idea, why umlauts are destroyed on reading (or saving the mail) as new issue or note?

e.g. "ü" get converted to ü
User avatar (0017342)
libregeek (reporter)
2008-03-14 04:05

I have successfully installed the email_reporting patch for mantis-1.1.1. The mails sent to a POP3 account is successfully registered in the mantis system. But the reporter doesn't get any confirmation mail or the bug_id.

How can I send back the issue_id to the sender, so that the user will get the issue_id and use it as a referencein future. Is there any patch available? If not can I work on this feature?
User avatar (0017345)
jojow (reporter)
2008-03-14 06:35

hi all,

we are using at the moment mantis 1.0.8 with the mail report function on a Linux Server and it's running perfect.

In the future we want to use mantis 1.1.1 with the mail report function on a Windows 2003 Server. Now I'm testing it and I've got many Problems with the mail report function. I know that we must change something in the parser.php file and that we need a htmlparser for windows.
I found a htmlpaser on [^] Has anybody experience with that tool? And it is able to use it for Mantis?

@brody: you wrote in note#16968
b) on windows: htmlparser\parse.bat
-> Where can I find this bat file? Can you upload it here?
User avatar (0017381)
alex_hoeck (reporter)
2008-03-16 17:55

I had some problems with my provider (save mode is set, so HTML parser cannot be launched). So I changed the function setBody in Mail/Parser.php:


    function setBody( $body ) {
        if ( 0 == strlen( $body ) || 0 != strlen( $this->_body ) ) {
        if ( 'text' == $this->_ctype['primary'] &&
             'plain' == $this->_ctype['secondary'] ) {
            switch ( $this->_transferencoding ) {
                case 'base64':
                case '8bit':
                case 'quoted-printable':
                    $this->_body = quoted_printable_decode( $body );
                    $this->_body = $body;
        } elseif ( $this->_parse_html &&
                   'text' == $this->_ctype['primary'] &&
                   'html' == $this->_ctype['secondary'] ) {
            $file = $this->_htmltmpdir . "/" . md5 ( $body );
            file_put_contents( $file, $body );
            if ( 'WIN' == substr( PHP_OS, 0, 3 ) ) {
                # Windows: parser command with parameter
                $this->_body = strip_tags($body); #shell_exec($this->_htmlparser . " " . $file);
            } else {
                # others: piped command
                $this->_body = shell_exec("cat " . $file . " | " . $this->_htmlparser);
        } elseif ( !$this->_parse_html &&
                   'text' == $this->_ctype['primary'] &&
                   'html' == $this->_ctype['secondary'] ) {
            $this->_body = strip_tags($body);


The change causes an include of the mailbody in the incidents description field when parsing of HTML mails is rturned off ($g_mail_parse_html = OFF;). It uses striptags() to remove HTML tags from the body.

If you like, include it.
User avatar (0017385)
brody (reporter)
2008-03-17 06:58

@libregeek's 0004286:0017342: I guess that the Mail Reporter adds new issues to your issue list. If the user gets not registered automatically on sending a new issue (as in my case), he must register at the site and switch its settings to be notified on new issues, but that are all issues. If you register new users ($g_mail_user_reporter = OFF), it might be additional implementation effort to get the user notified about his own issue, because mantis' e-mail notification on new issues does by default only notify developers and above, if they want to be notified about it(personal settings). Additionally you can influence this maybe through settings in the configuration. Take a look at $g_notify_flags
User avatar (0017386)
brody (reporter)
2008-03-17 07:00

@jojow's 0004286:0017345: The parse.bat is only a wrapper around "my" htmlparser, the jericho-html parser, I use. If you need it, I'll could put it here, but I think your parser might be wrapped through another call as mine.
User avatar (0017388)
jojow (reporter)
2008-03-17 11:39

I've tested the "strip_tags" - function. With only this function I get an error 401 and the INSERT into the database won't work.
Now I'm testing the php-functions "htmlentities" and "htmlspecialchars". Then the Insert works, but I'll get some signs that I don't want :-(
Like "'ü' instead of 'ü', ß' instead of 'ß' and '&nbsp;' or '&amp;'. Can that be a problem with UTF-8 Unicode (utf8) in MySQL (version 5.1.23)?
    function setBody( $body ) {
        if ( 0 == strlen( $body ) || 0 != strlen( $this->_body ) ) {
        if ( 'text' == $this->_ctype['primary'] &&
             'plain' == $this->_ctype['secondary'] ) {
            switch ( $this->_transferencoding ) {
                case 'base64':
                case '8bit':
                case 'quoted-printable':
                $this->_body = quoted_printable_decode( $body );
                $this->_body = $body;
        } elseif ( $this->_parse_html &&
                   'text' == $this->_ctype['primary'] &&
                   'html' == $this->_ctype['secondary'] ) {
            $file = $this->_htmltmpdir . "/" . md5 ( $body );
            file_put_contents( $file, $body );
            if ( 'WIN' == substr( PHP_OS, 0, 3 ) ) {
                # Windows: parser command with parameter
    # START 17.03.08 --------------------------------------------------------
                # Infos from Bug 4286 Note 0017381
                #$this->_body = shell_exec($this->_htmlparser . " " . $file);
                $this->_body = strip_tags($body);

    # @@@ TEST jojow !!! ONLY T E S T !!!
                $hjw_body = $body;
                $hjw_body = strip_tags( $hjw_body );
                $hjw_body = htmlentities( $hjw_body );
                $hjw_body = htmlspecialchars( $hjw_body );
                $this->_body = $hjw_body;
    # END 17.03.08 --------------------------------------------------------
            } else {
                # others: piped command
                $this->_body = shell_exec("cat " . $file . " | " . $this->_htmlparser);
User avatar (0017390)
jojow (reporter)
2008-03-17 11:46

that's funny:
I wrote: Like ' & uuml ' (without Space) instead of 'ü', ' & szlig' (without Space) instead of 'ß' and ' ' or '&'
And I see 'ü' instead of 'ü' etc.
But in my Installation is standing "Mit freundlichen Gr & uuml & szlig" (without Space after & ) instead of "Mit freundlichen Grüßen".
I hope now it is readable.
User avatar (0017393)
alex_hoeck (reporter)
2008-03-17 14:02
edited on: 2008-03-17 14:05

@jojow: I found a small PHP package which possibly fits the needs: [^]

But I did not try it.


By the way: I allways get a strange error message when adding comments with the "Add Note" Form on your installation:

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 199508 bytes) in /home/mantisbt/public_html/bugs/core/database_api.php on line 171

Does not belong here but fyi...

User avatar (0017450)
libregeek (reporter)
2008-03-25 07:44

@brody: Thanks for your clarification.

In my case the implementation is like the following - I don't create a new user when somebody sent a bug(via email) to mantis. Instead, it uses a common account(like mailUser) for all users to report the bug to mantis. I am wondering how difficult it will be to add some email-ids to a issue so that they will be notified about the bug status and notes.
User avatar (0017550)
bernhard (reporter)
2008-04-04 06:16


I managed to get German umlauts working by changing Mail/Parser.php:

in setBody() I added a new line at the end:

    function setBody( $body ) {
        if ( 0 == strlen( $body ) || 0 != strlen( $this->_body ) ) {
        if ( 'text' == $this->_ctype['primary'] &&
             'plain' == $this->_ctype['secondary'] ) {
            switch ( $this->_transferencoding ) {
                case 'base64':
                case '8bit':
                case 'quoted-printable':
                    $this->_body = quoted_printable_decode( $body );
                    $this->_body = $body;
        } elseif ( $this->_parse_html &&
                   'text' == $this->_ctype['primary'] &&
                   'html' == $this->_ctype['secondary'] ) {
            $file = $this->_htmltmpdir . "/" . md5 ( $body );
            file_put_contents( $file, $body );
                        if ( 'WIN' == substr( PHP_OS, 0, 3 ) ) {
                                # Windows: parser command with parameter
                                $this->_body = shell_exec($this->_htmlparser . " " . $file);
                        } else {
                                # others: piped command
                $this->_body = shell_exec("cat " . $file . " | " . $this->_htmlparser);
        $this->_body = htmlentities($this->_body); //

In setSubject I also added htmlentities():

    function setSubject( $subject ) {
        $this->_subject = htmlentities( quoted_printable_decode( $subject ) );

This works for me with plain text and html mails.
User avatar (0017796)
remko (reporter)
2008-05-08 08:28


Here at the City of Amsterdam ( we've been using this GREAT addition to mantis for about 6 months now. We'd like to update to Mantis 1.2. But as you know this e-mail reporting function does not work in that version of Mantis. Are there any plans to for an update for this function to work with Mantis 1.2? Perhaps as a plugin even? Thanks for your reply!
User avatar (0017839)
rjosulli (reporter)
2008-05-15 05:16
edited on: 2008-05-15 05:20


I'm working on integrating this into our system. I've hit a problem with net_pop3, which isn't quite decoding mime e-mails properly. Sometimes a mail sent with text and html bodies will contain both: this appears as the body repeated twice, with the first copy containing no newlines (I presume the whole thing is being sent to the html processor) - this is most noticeable from outlook and yahoo! mail though it does not happen every time.

Also, if you send a mail from gmail with an attachment, the body is sent as an inline text part, and is not picked up at all. My experience with this is that it can be reproduced every time, simply send a gmail with an attachment and "No Description found" is inserted.

Anybody else having these problems? I don't want to have to go in and change net_pop3, and since it's been nearly 3 years since the last release I don't hold out much hope for a bug-fix. I'm going to look at piping it out to a different program/script....

User avatar (0017926)
brody (reporter)
2008-05-27 08:05

@rjosulli: the decoding of mime mails is not done by net_pop3, but by the Mail-package, especially Mail_mimeDecode and Mail_Parser. I remember that I've to fix several issues there (we use MS Exchange/Outlook, too) to get it working.

But in the meantime its working in most of cases.
User avatar (0017986)
cas (reporter)
2008-06-02 05:15
edited on: 2008-06-02 08:40

We also use this feature heavily and I am surprised it is not in the latest versio (1.2.0).
Here [^] it is stated that the original author had joined the team. Would have hoped Gerrit managed to convince the team to get in this release.
It wil just mean that we have to patch the latest version ourselves to get it working. With so many users of this feature, it will become available.
Without it no upgrade so I may have to this myself.

User avatar (0018014)
dapozzom (reporter)
2008-06-05 06:05
edited on: 2008-06-05 06:08

I'm using Mantis 1.1.1 on Linux with following settings and all tims that a new mail is sent a ticket is created with in the body the plain text and html text.
Is the HTML part skippable in the ticket creation
$g_mail_use_reporter = ON;
    $g_mail_reporter = "MAIL";
    $g_mail_auto_signup = OFF;
    $g_mail_debug = OFF;
    $g_mail_additional = ON;
    $g_mail_save_from = ON;
    $g_mail_parse_mime = ON;
    $g_mail_parse_html = ON;
    $g_mail_bug_priority_default= NORMAL;
    $g_mail_bug_priority= NORMAL;
    $g_mail_html_parser = '/usr/bin/w3m -t text/html -dump';
    $g_mail_tmp_directory = OFF;
    $g_mail_fetch_max = 1;
    $g_mail_auth_method = 'USER';
    $g_mail_use_bug_priority = OFF;
    $g_mail_default_bug_category = 'Assistenza';
    $g_mail_directory = './Mail_Sisset';
    #$g_mail_from = './Mail_LOMB_CALL';
    $g_mail_tmp_directory = './tempmail';

User avatar (0018018)
brody (reporter)
2008-06-05 12:48

These settings influence the html treatment:

    $g_mail_parse_html = ON;
    $g_mail_html_parser = '/usr/bin/w3m -t text/html -dump';

IF you switch first setting of, html is not handled any more.
User avatar (0018024)
dapozzom (reporter)
2008-06-06 03:07

My incoming mail is generated with HTML/Plain text setting on the client, so if I will put the $g_mail_parse_html =OFF the description will contain " No description found", setting to ON the description will contain the HTML body and the "translated" one. So the bug description contains twice the same information.
User avatar (0018041)
dean2008 (reporter)
2008-06-09 19:08

I am confused with all this history. Can someone give me a basic outline of how to get this thing running on 1.0.8 and Windows 2003? What files should I download, will I need that html parser, etc?

User avatar (0018044)
cas (reporter)
2008-06-10 05:35
edited on: 2008-06-10 05:37

I seem to have a problem with very long URLs which get truncated if received by mail.
here is the url:
http://xxxxxx/rnt/Material%20Master/Form/filling%20in%20progress(RnD%20n%20Pur%20n%20QC)/For%20Dataman%27s%20action%20(.Dataman%20via%20Alina)/MINI%20MM%20P18300-AE%20Soo%20040608.xls [^]

And this is how it shows up after importing:
<http://xxxxxx/rnt/Material%20Master/Form/filling%20in%20progress [^](RnD%20 [^]

Any suggestions someone?

User avatar (0018046)
brody (reporter)
2008-06-10 08:37
edited on: 2008-06-10 08:44

@dapozzom 0004286:0018024, you wrote: My incoming mail is generated with HTML/Plain text setting on the client, so if I will put the $g_mail_parse_html =OFF the description will contain " No description found", setting to ON the description will contain the HTML body and the "translated" one. So the bug description contains twice the same information.

If you have a clean "plain text" part in your mail, you should get it also, if you switch html parsing to OFF. If you get "no description found", did you maybe switch "mime parsing" to OFF. It seems to me that something with your mails is not ok for the parsing process either in mime, which normal correctly differ between text and html parts in general inside mime based mails. I've both "mime parsing" and "html parsing" on, which works

User avatar (0018047)
brody (reporter)
2008-06-10 08:49

@cas 0004286:0018044: Take a look into the datbase table to decide, if the line breaks (you see) come from the parsing process or from the bugtracker userinterface.

If in the database (bug text table) a URL in the description column is not broken by <cr> or <lf>, the gui breakes an disforms the URLs
User avatar (0018061)
cas (reporter)
2008-06-11 09:39


all long entries direct through the gui are fine, only when parsed at mail receipt wh have this behaviour.
It very much looks like it divides it in chuks of 64 characters.
Have not been able to track this down.
User avatar (0018120)
cas (reporter)
2008-06-17 02:44

Found another little issue and prepared fix for it.
We have 2 instances of mantis running in our organization. In case a bug-id of one instance is sent to the other it might be recognized as to be treated as a bugnote rather than a new issue. In principle not a real big issue unless the correspong Bug not exists.
In order to overcome this problem look for this line:
if ( mail_is_a_bugnote( $p_mail['Subject'] ) ){
and replace with:
if ( mail_is_a_bugnote( $p_mail['Subject'] ) && bug_exist($t_bug_id) ){
User avatar (0018121)
cas (reporter)
2008-06-17 02:47
edited on: 2008-07-15 01:48

Found another little issue and prepared fix for it.
We have 2 instances of mantis running in our organization. In case a bug-id of one instance is sent to the other it might be recognized as to be treated as a bugnote rather than a new issue. In principle not a real big issue unless the corresponding Bug not exists.
In order to overcome this problem look for this line:
if ( mail_is_a_bugnote( $p_mail['Subject'] ) ){
$t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] );
and replace with:
$t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] );
if ( mail_is_a_bugnote( $p_mail['Subject'] ) && bug_exist($t_bug_id) ){

User avatar (0018362)
SL-Gundam (reporter)
2008-07-11 08:55

Uploaded a new package with changes files for version 1.1.2

Jun 2008
- update to mantis 1.1.2
- Changes applied based on cas's code' NOTE 0016246
- Using html2text 1.2 created by Jose Solorzano of Starnetsys, LLC. for html email parsing
- html parsing on by default now
- All pear packages updated to latest available versions
- Necessary query adjustments in category_api.php
- Some small bug fixes and adjustments.

Hope this package is usefull for some of you
User avatar (0018499)
SL-Gundam (reporter)
2008-07-14 07:31

Sorry for this but there was small typo which caused problems with processing attachments.

Here is the fixed package:

Jul 2008
    - Fixed problem with attachments not being processed properly
User avatar (0018506)
SNAFU (reporter)
2008-07-14 09:04
edited on: 2008-07-14 09:23

I installed the latest version (1.1.2) and found, that adding mails as notes doesn't work. The cause was the function mail_is_a_bugnote()
a/ $t_bug_id is not initialized in the if-condition
b/ the parameter for mail_get_bug_id_from_subject() was wrong

For me the following version works fine:

        # --------------------
        # return true if there is a valid mantis bug referernce in subject
        function mail_is_a_bugnote ( $p_mail_subject ) {
                if ( preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{1,7})\]/", $p_mail_subject) ) {
                        $t_bug_id = mail_get_bug_id_from_subject( $p_mail_subject );
                        if (bug_exists( $t_bug_id )) {
                                return true;
                        else {
                                 return false;
                        return false;

... and mails with attachments are not analyzed right: "No description found"
... and the sytem does not recognize, that the mail comes from an existing user ... ?!

User avatar (0018692)
grangeway (reporter)
2008-07-27 18:24


Is: [^] (130,518 bytes) 2008-07-14 07:29 [Delete]

The latest version of this?

User avatar (0019220)
Devslashnull (reporter)
2008-08-25 13:43


Just wanted to make a suggestion for a future release. If possible can the passwords not be stored in plain text.


User avatar (0019474)
Devslashnull (reporter)
2008-09-29 16:01

Is this still be developed or has this been abandoned? Its been awhile since I've seen any updates are there are a few features not working right. I'm having issues with replies to emails not being added as bug notes and the mail parser seems to fail on characters with accent marks on them.


User avatar (0019490)
lecouds (reporter)
2008-10-03 10:51


I have the same problem with french accents, is there a way to get around this issue ?


User avatar (0019577)
mcraig88 (reporter)
2008-10-16 12:54

Hello, how does this work if you are using Active Directory? Our UserIDs are not email addresses, they are our network logins.

Can this check AD, and create an account using a network login, and fill in the email address as per AD?

Seems like everything I read above is related to an internet facing installation.

User avatar (0019649)
TomR (reporter)
2008-10-23 08:02
edited on: 2008-12-03 11:44

Suggestion for future release:

Per project one specific reporter. Now you have to choose between one reporter ( 'Mail' ) or all kind of different reporters. Suppose you have within one organization, which reports by email, one contactperson. You want that to be the reporter. This give them feedback on the issue created ( Issue ID ). I do not want all different reporters in the system. ( Otherwise I would have make accounts for them. Later on you could also update the reporter field in the issue ).

User avatar (0019650)
TomR (reporter)
2008-10-23 08:05
edited on: 2008-10-25 05:46

I am having te same problem with recognizing emails as bugnotes ( already existing issues ). See 0004286:0018506.

However for me that is not the solution. How is this suppose to work. What do you put in the subject of the email, just the issue ID ( with or without the leading zero's ) or something else.

Found what the problem was.

Your subject must contain [ProjectName IssueID]. I use the leading zero's with issue ID just as they are in the normal emails.

User avatar (0019681)
TomR (reporter)
2008-10-25 04:10
edited on: 2008-10-25 05:43

I'm having problems with emails containing attachments. It will not attach them to a isuue, and log file shows:

   SYSTEM WARNING: file_put_contents(/image001.jpg)
   [[1]function.file-put-contents]: failed to open stream: Permission Denied

However normal uploads by Mantis are working correctly.

What could be the problem?

Found what the problem was.

In mail_api.php file upload in function mail_add_file
$t_file_name = ini_get( 'upload_tmp_dir' ) . '/' . $p_part['name'];

However in my php.ini upload_tmp_dir was not set so it tried to write into the rootdir '/', which was not allowed.

User avatar (0019715)
DaVinci (reporter)
2008-10-28 10:51

i can not get it to work on 1.2.0a2
anyone have any suggestions

i couldnt even get it to work on 1.1.3 or 1.1.4
User avatar (0019734)
TomR (reporter)
2008-10-30 18:37

Hello DaVinci. Did not test it on 1.2.0a2, but works on 1.1.4.

What is your problem exactly?
User avatar (0019777)
DaVinci (reporter)
2008-11-05 03:23

the problem is that in v.1.2.a2 i dont get the fields where i define the mailserver and mail address which Mantis should use to collect the e-mails from

In 1.1.4 and 1.1.3 the e-mails that Mantis collects are empty: no description, no attachemnts no nothing
User avatar (0019778)
DaVinci (reporter)
2008-11-05 03:23

the problem is that in v.1.2.a2 i dont get the fields where i define the mailserver and mail address which Mantis should use to collect the e-mails from

In 1.1.4 and 1.1.3 the e-mails that Mantis collects are empty: no description, no attachemnts no nothing
User avatar (0019779)
DaVinci (reporter)
2008-11-05 03:31

i've a suggestion:
- upload the latest zip file with all the changes and remove all others
- change the code such that if the subject field is something like Fw:[Diverse cases 2032903]: <case_name>, the bug_report_mail.php should jump
- move the mails that have been collected to another folder so that if something goes worng, like empty desciption, we can retrive the bug again
- im running bub_report_mail.php as cornjob and sometimes it doesnot delete mails and when this happens during the weekend it ceats over 1000 duplicate cases thats uses mantis numbers. Becasue of this issue our Mantis have used up over 3000 numbers
User avatar (0019831)
brody (reporter)
2008-11-10 11:31


Reg. your last mentioned problem of examining the same mail twice, I added a check, if the mail is to old and has been checked before...

Reg. empty mails, what product is the mailserver you use?! I guess, a M$ Exchange...
User avatar (0019886)
DaVinci (reporter)
2008-11-14 03:12

its a webmail provided by
you wrote that u added a check that if mail is too ols and has been check before..
but the mails on the account never get checked and the cornjob runs every 3 minutes

i've tried to access the mails from LotusNotes but it didnt work :(
User avatar (0019888)
brody (reporter)
2008-11-14 04:49

Because this interface (POP3) is very important for my work, I developed several extensions in my own installation to get it working into my process .. one of that was to save the last checked mail datestamp to prevent same mails. Much time needed to get this working against MS Exchange Server, because this is not 100% compliant .. I guess with Lotus Notes you'll have similar problems, but who knows...its a job of debugging, trying out and....
User avatar (0019889)
DaVinci (reporter)
2008-11-14 05:14

dude..u have to complete ur sentences :)
User avatar (0019897)
jreese (reporter)
2008-11-14 13:44

This would make for a great plugin; I don't think it'll be making it's way into Mantis core anytime for 1.2.x, so removing the target.
User avatar (0019911)
DaVinci (reporter)
2008-11-17 04:44

@all the people above
is there a possibility somehow to import the reporter's name from e-mail header into Reported by feild in Mantis?

when a reporter sends a mail his e-mail address is imported in header:

Report from: John Doe <>

John Doe is always a user in Mantis and i want his name to be imported into Reported by filed instead of Reporter [] which is the name of the e-mail address everyone sends e-mail to.

I hope you understands the question.
User avatar (0019913)
brody (reporter)
2008-11-17 09:54

@JReese: When will this come - as plugin? This important feature for a lot of users is displaced many many times...

@DaVinci: Think, that I understand you. The patches for the feature to process e-mails can put that name into the reporter's field. But therefore a reporter entry (a new user) must be generated every time. Therefor two switches exists: $g_mail_use_reporter and $g_mail_reporter. If first is set to "OFF" every issue is saved under its reporter. The "Reported from:" is controlled by $g_mail_save_from switch. Seems to be a misconfiguration in your case.
User avatar (0019931)
DaVinci (reporter)
2008-11-18 08:19

so i should set $g_mail_use_reporter OFF!
what should i do with $g_mail_save_from
User avatar (0019971)
brody (reporter)
2008-11-21 11:39

@DaVinci: Yes (for the first) - as documented in the settings file ... read:"
    # --- mail reporting settings -----
    # This tells Mantis to report all the Mail with only one account
    $g_mail_use_reporter = ON;

    # The account's name for mail reporting
    # Also used for fallback if a user is not found in database
    $g_mail_reporter = 'Mail';
 and the second part also documented in the config file:
    # Write sender of the message into the bug report [IF set to ON!]
    $g_mail_save_from = OFF;
User avatar (0019975)
brody (reporter)
2008-11-21 12:23

@indy: thanks again for providing the email-pop3 addon. I'm using the (self-extended) mantis-1.0.5.patch.gz addapted to V1.0.7 and have a problem with the original Parser.php, which mangles some mails by second time applying a decoding of "quoted printable". The first apply comes from the origin Mime_Decode class (if configured to decode mime mails directly) and the again decoding of the decoded text comes from the Parser.php class function setBody(), which decodes a plain text again and calls a html parser for html part of mails.

Any idea? Is correct to generally make setBody() to only set the body and do no further decoding?
User avatar (0020027)
DaVinci (reporter)
2008-11-25 08:23

this patch is living its own life on my server
sometimes i get the norwegian special chatacters and sometimes i dont
sometimes i get my name in Reporeted by filed and sometims i dont

what am i doing wrong?
User avatar (0020180)
TomR (reporter)
2008-12-02 06:06

It seems that attached *.txt files are not attached to the issue.

Can anybody explain me the reason for that?
User avatar (0020211)
DaVinci (reporter)
2008-12-03 07:53

so i've done a coiple of tests and managed to create the desired incident
it seems that when i run report_bug_mail.php as a scheduled job on W3K then the special characters and the name of the reporter are missing
when i run it manually in the browser then i get special characters and the reportes name
any suggestions how can i make it work with scheduled job?
User avatar (0020212)
DaVinci (reporter)
2008-12-03 07:57

is there a way to get this solution working with LotusNotes?
it is very desirable since now the solution gets mail from a private web-server which could be down at times but our LotusNotes server is up all the time and is stable

i couldnt get it to work with LotusNotes
User avatar (0020228)
brody (reporter)
2008-12-04 08:45
edited on: 2008-12-04 08:49

@DaVinci at 07:53: I guess you mean W2K (I don't know W3K) :-)
Well, running a php-page inside a webserver or with the standalone executable might lead to get a different configuration. In the first case, the webserver and the configuration of it is the base of the job. In the later case the executable runs in the context of another process, which might have lesser rights or other settings, than the webserver. Its very difficult to find out. I got some differences by directly debugging the script execution using the executable.

@DaVinci at 07:57: If LotusNotes is capable of being contacted by POP3 and you or your application gets the rights to do so. We use (sorrily) Exchange Server and I found a lot of problems, because Microsoft has its own standards regarding POP3 and IMAP. I've no experience regarding contacting Lotus Notes.

User avatar (0020229)
brody (reporter)
2008-12-04 08:47
edited on: 2008-12-04 08:49

@TomR's note 0004286:0020180: It might be forbidden in this installation. Some of the admins should/could tell you, the reason. I'm only reporter here...

User avatar (0020234)
TomR (reporter)
2008-12-04 11:08

It is in my own installation. Normal uploading through web interface goes fine (*.txt files). However when using report by email, files with a *.txt extension are not attached to issues. Other files are attached correctly.
User avatar (0020315)
rajendran (reporter)
2008-12-10 07:35


Really very nice, it is great work

Actually it's working fine for bug report email.I got following issues kindly help me very urgent.

1.when user reply via email, the whole content(exist notes also) stored in bug notes but i want only reply messags only stored on bug notes.

2.if user attach the file means the bug notes displayed "No description found" but file is not attached to bug notes.
User avatar (0020317)
brody (reporter)
2008-12-10 08:20

@TomR 0004286:0020234: I found same problem in context to Exchange Server, which sometimes handled *.txt attachements not as attachement or slightly different to normal attachment. If you use Exchange Server as your e-mail backend that might be the reason for that mishaviour. A general fix is difficult; I fixed Parser.php for that, after digging deep into Exchange's Mail Handling. In general I had to fix/correct a lot of things. BTW: THe mentioned patch seems to be in indys upload of package 1.1.1

@Rajendran 0004286:0020315:
1. You need a complex function, which handles this. I built and extended one for my installation, which compares headers and given notes about the date added; therefor the add date of a note is patched to the date of the mail from where the note comes from - is very special.

2. Not in my understanding
User avatar (0020318)
TomR (reporter)
2008-12-10 08:31

@Brody, Thnx for your reply, however no Exchange whatsover. Just POP3 on Linux server. I used Mantis-1.1.2-changed files only-unofficial and that seemd to work, except voor *.txt uploads.
User avatar (0020319)
brody (reporter)
2008-12-10 09:21

POP3 is a "client side" protocol. I connect to Exchange by POP3, but that does not matter the format of the messages. Maybe your mail server on linux does also have special behaviour. I do not know, I found some misbehaviour on Exchange and patched my installation adequately. If you need to get this fixed on your installation, you'll have to debug it. For that I use the eclipse PDT Plugin (org.eclipse.php) in combination with the free available zend debugger plugin and for the non mail functions a local installation on my laptop.

Good luck!
User avatar (0020320)
rajendran (reporter)
2008-12-10 09:26


thanks for your reply brody

2.when user reply via email with file attachment, the file is not displayed in notes section and also notes are displayed "No description found" instead of display original reply messages. if any extra configuration need currently i used following configuration in config_inc.php file

    # --- email variables -------------
    $g_administrator_email = '';
    $g_webmaster_email = '';

    # the "From: " field in emails
    $g_from_email = '';

    # the return address for bounced mail
    $g_return_path_email = '';
    $g_mail_reporter = "Mail";
    $g_mail_use_reporter = ON;
    $g_mail_debug = ON;

    # --- file upload settings --------
    # This is the master setting to disable *all* file uploading functionality
    # The default value is ON but you must make sure file uploading is enabled
    # in PHP as well. You may need to add "file_uploads = TRUE" to your php.ini.
    $g_allow_file_upload = ON;

kindly help me very urgent can i change any configuration please advise me

I need how can i set "bug report email" functionality in our external projects.that is i using testing project in this project i need integrate the bug report email functionality kindly give yours valuable suggestion.
User avatar (0020329)
libregeek (reporter)
2008-12-11 02:38

In the mantisbt wiki it's mentioned that an email_reporting feature is being done( [^]). Is this the patch that would be included or are the developers working on some other patch ?
User avatar (0020332)
brody (reporter)
2008-12-11 05:18

Rajendran, from your settings I think, there are some more settings regarding the mail reporting: Please check against my settings, which produces wanted output in general and overwrite the default:

    # Write sender of the message into the bug report
    $g_mail_save_from = ON;

    # Parse MIME mails (may require a lot of memory)
    $g_mail_parse_mime = ON;

    # Parse HTML mails
    $g_mail_parse_html = ON;

Furthermore für the last setting you need a correctly configured HTML-Parser, here is my own:
    # HTML Parser Command
    # It should print the formatted text to STDOUT
    # For example: "/usr/bin/w3m -T text/html -dump"
    # junction-linked into mantis main dir
    $g_mail_html_parser = 'htmlparser\parse.bat';

This setting should only demonstrate how to set, but you can't take over!

And a correctly set directory:

    # directory for saving temporary mail content
    $g_mail_tmp_directory = 'c:/WINDOWS/Temp';

Both are preconfigured for an unix environment.
The file upload settings are IMO only for the web part of the application. Regarding that neither the file is attached, nor the note displays the reply mail, there are several reasons for that - I can't help more. I'd suggest the same, I told TomR with his problem of adding *.txt files
User avatar (0020333)
brody (reporter)
2008-12-11 05:21

libregreek, seems to be the available patches. I do not know any release version of mantis, who has this feature completely inside and as the history of this item shows, the integration is moved to later versions many times. I think its difficult for them.

Any comments from a mantis developer?
User avatar (0020334)
rajendran (reporter)
2008-12-11 05:27


I am using "" files but without the file attachment messages are stored fine, but when upload the file attachment the messages are not displayed correctly(the messages are "No descrption found and also file is not stored in our server").

kindly help me i had sent my configuration settings above the notes
User avatar (0020349)
libregeek (reporter)
2008-12-12 02:04

I shall take this issue to the mantis developer list.
User avatar (0020350)
rajendran (reporter)
2008-12-12 02:36


when run "bug_report_mail.php" got the below issues


A necessary field 'Category' was empty. Please recheck your inputs.

2.Notes does not added to bug

kindly help me pls.very urgent

3."X-Mantis-Body"]=> string(14740) "This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: Unrouteable address ------
User avatar (0020356)
rajendran (reporter)
2008-12-12 04:42


when run "bug_report_mail.php" got the below issues


A necessary field 'Category' was empty. Please recheck your inputs.

2.Notes does not added to bug

kindly help me pls.very urgent

3."X-Mantis-Body"]=> string(14740) "This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: Unrouteable address ------
User avatar (0020358)
rajendran (reporter)
2008-12-12 06:53

I run this page "Run bug_report_mail.php" got the below error [pear_error: message="-ERR Login failed." code=-1 mode=return level=notice prefix="" info=""]

how can i fix this

email reply messages(notes) added successfully but when attach the file with reply notes, attachment file are not stored in our server

kindly help me
User avatar (0020359)
DaVinci (reporter)
2008-12-12 07:05

in mantis v.1.1.5 and mail-pluinn version 1.1.2 the mails come in the mail box hours after the case is posted eventhough mantis database is updated as soon as bug_report_mail.php is run

any suggestions?
User avatar (0020361)
rajendran (reporter)
2008-12-12 09:14


I need track the reply messages from existing mail for our project same for mantis concept.

is it possible? if possible give me any reference site or if u have any script sent me

pls help me
User avatar (0020362)
libregeek (reporter)
2008-12-12 09:15

@brody and other developers:
Please refer: [^]

I think it's worth re-write this patch to suit the new plugin system in mantis-1.2.

Does this makes sense?
User avatar (0020378)
rajendran (reporter)
2008-12-16 04:56


when running "bug_report_mail.php" i got the following error

SYSTEM WARNING: fopen(Daily task report status.xls) [function.fopen]: failed to open stream: Permission denied


File upload failed. File is not readable by Mantis. Please check the project settings

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

kindly help me

following is my
# set these values to match your setup
    $g_hostname = "localhost";
    $g_db_username = "testun";
    $g_db_password = "testpwd";
    $g_database_name = "testdb";
    $g_db_type = "mysql";

    # --- email variables -------------
    $g_administrator_email = '';
    $g_webmaster_email = '';

    # the "From: " field in emails
    $g_from_email = '';

    # the return address for bounced mail
    $g_return_path_email = '';
    $g_mail_reporter = "Mail";
    $g_mail_use_reporter = ON;
    $g_mail_debug = ON;
    $g_mail_fetch_max = 1;
    $g_mail_delete = ON;
    # Write sender of the message into the bug report
    $g_mail_save_from = ON;

    # Parse MIME mails (may require a lot of memory)
    $g_mail_parse_mime = ON;

    # Parse HTML mails
    $g_mail_parse_html = ON;
    $g_mail_tmp_directory = '/tmp';
User avatar (0020379)
DaVinci (reporter)
2008-12-16 06:53

a couple of things:
- you have to set up a postmaster account for this purpose..i didnt get it to work with anyother
- then you have to create an account in Mantis lets say helpdesk and definethe postmaster-address for that account
- then you have to create a category Reported by mail or something in Mantis
- then you have to go into the account and set the action and activate it
- use mail adress and mail server address while configuring [try with username if u dont get to work it with the mail address]

this is how i've set it up

    # Mail Reporting

    # --- mail reporting settings -----
    # This tells Mantis to report all the Mail with only one account
    $g_mail_use_reporter = OFF;

    # The account's name for mail reporting
    # Also used for fallback if a user is not found in database
        # helpdesk is the name of the account holder all the mails are send from
    $g_mail_reporter = 'helpdesk';

    # Signup new users automatically (possible security risk!)
    # Default is OFF, ignored if mail_use_reporter is ON
    $g_mail_auto_signup = OFF;

    # How many mails should be fetched at the same time
    # If big mails with attachments should be received, specify only one
    $g_mail_fetch_max = 1;

    # Write complete mail into the "Additional Information"
    # NOTE - doesn't function because the variable doesn't exist in the function where it is used. So just leave OFF
    $g_mail_additional = OFF;

    # Write sender of the message into the bug report
    $g_mail_save_from = ON;

    # Parse MIME mails (may require a lot of memory)
    $g_mail_parse_mime = ON;

    # Parse HTML mails
    $g_mail_parse_html = ON;

    # HTML Parser Command
    # It should print the formatted text to STDOUT
    # For example: "/usr/bin/w3m -T text/html -dump"
    # NO LONGER NEEDED, thx to html2text
    #$g_mail_html_parser = OFF;
    $g_mail_html_parser = '/usr/bin/w3m -t text/html -dump';

    # directory for saving temporary mail content
    $g_mail_tmp_directory = '/tmp';

    # Delete incoming mail from POP3 server
    $g_mail_delete = ON;

    # Signup new users automatically (possible security risk!)
    # Default is OFF, ignored if mail_use_reporter is ON
    $g_mail_debug = OFF;

    # Save mail contents to this directory if debug mode is ON
    $g_mail_directory = '/tmp/mantis';

    # The auth method used for POP3
# Valid methods are: 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'
#NOTE: Try to chnage between these methods..the most common is USER
    $g_mail_auth_method = 'USER';

    # Looks for priority header field
    $g_mail_use_bug_priority = ON;

    # Default priority for mail reported bugs
    $g_mail_bug_priority_default = NORMAL;

    # Default bug category for mail reported bugs (Defaults to "default_bug_category")
    # Because in Mantis 1.1.0a3 a category is required, we need a default category for issues reported by email.
    # Make sure the category exists and it has been configured correctly
    #$g_mail_default_bug_category = '%default_bug_category%';
#NOTE Reported by mail: is the name of the bug category in MANTIS [you have to create one] where all the mails that are reportet by mail come
    $g_mail_default_bug_category = 'Reportet by mail';

    # Classify bug priorities
    $g_mail_bug_priority = array(
        '5 (lowest)' => 10,
        '4 (low)' => 20,
        '3 (normal)' => 30,
        '2 (high)' => 40,
        '1 (highest)' => 50,
        '5' => 20,
        '4' => 20,
        '3' => 30,
        '2' => 40,
        '1' => 50,
        '0' => 10,
        'low' => 20,
        'normal' => 30,
        'high' => 40,
        '' => 30,
        '?' => 30

User avatar (0020400)
01 (reporter)
2008-12-17 17:59

just a short question: does the status "assigned" mean that this killer feature will become part of the mantis distribution finally? :->>>
User avatar (0020411)
TomR (reporter)
2008-12-18 03:12
edited on: 2009-01-07 05:34

If you get file upload failed, permission denied. Check your upload_tmp_dir in php.ini.

See 0004286:0019681

User avatar (0020632)
jreese (reporter)
2009-01-15 15:38

01: considering that it was assigned three years ago to a developer who no longer contributes to MantisBT, and that no other current developer has stepped up to the task, I'd say "no".

However, as I mentioned in a previous comment, the new plugin system in the 1.2.x versions add the possibility for someone to create this as an external feature for MantisBT that won't require editing core files. However, that still requires someone to volunteer the time and energy needed to get something like that working.
User avatar (0020658)
cas (reporter)
2009-01-20 05:49

In case nobody is working on this, I am willing to transform this into a plugin.
The reason being that it is a vital part of a lot of installations (including ours) and the believe that it actually should be part of the core.
User avatar (0020666)
cas (reporter)
2009-01-21 08:35

Have this plugin nearly ready and am looking for testers. The plugin has been created within the plugin system of the 1.2.x version, more specific on the very last release 1.2.0a3
User avatar (0020668)
TomR (reporter)
2009-01-21 08:59


I am willing to test the plugin, however I first have to setup a 1.2.0a3 version of mantis. I will do that this weekend. Please post when you are ready an upload plugin here.
User avatar (0020674)
cas (reporter)
2009-01-21 14:48

Have attached the email plugin called Recmail (Receive mail). Based upon Indy's work.
Be aware have tested this with 1.2.0a3 and sofar it works (perhaps it will work on 1.6.x but have not tried).
Have tested with and without attachment (file upload method=DISK).
User avatar (0020830)
libregeek (reporter)
2009-02-10 06:48

I tried to install the plugin in a GNU/Linux (Fedora) server and failed due to incompatibility in directory separator(used \ instead of /) in the require_once statements. These are mainly noticed in the pages/ folder. I have created a patch for the same. Please commit if it doesn't break anything else.
User avatar (0020833)
libregeek (reporter)
2009-02-11 04:30

I have tried the patch in CentOS server and it seems it has some issues in connecting to the POP3S server. I have a secure POP3 server running at port 995. I have changed the port number in api/mail_api.php , but it didn't helped. This server already have mantis-1.1.2 with the old patch and it works without any issues.
User avatar (0020870)
cas (reporter)
2009-02-17 06:27

I will incorporate the patch and see if I can do something on the POP3S issue.
Those parts of the code have hardly changed in my recollection but will verify.
User avatar (0020882)
midgardtech (reporter)
2009-02-18 12:01
edited on: 2009-02-18 12:07

Hi. I have been testing this plugin for use within my company.

Two things I noticed but could be doing something wrong:

1) Replies to tickets made via email create new tickets and are not added to bugnotes.
2) I sent in an email with a file attachment but the attachment never showed up on the ticket.



User avatar (0020883)
cas (reporter)
2009-02-18 14:44

Replies to tickets quite often conatin the full bug-report. This is a pain.
In order to avoid this, open mail_api.php and search for:
$t_mail['X-Mantis-Body'] = trim( $t_mp->body() );
if ( empty( $t_mail['X-Mantis-Body'] ) ) {
   $t_mail['X-Mantis-Body'] = "No description found";

add after this section:
$lookfor = "-----Original Message-----";
$lookin = $t_mail['X-Mantis-Body'];
$sep = strpos($lookin, $lookfor);
if ($sep){

This has been tested in version 1.1.X
User avatar (0020884)
cas (reporter)
2009-02-18 15:22

@ Tim,
what is your storage Disk or Database ?
Will check on the replies
User avatar (0020885)
midgardtech (reporter)
2009-02-18 16:59

Good question. Where do I find that? Whatever the default is, I guess. I never made any changes to it that way.
User avatar (0020886)
cas (reporter)
2009-02-18 17:37

check this setting: $g_file_upload_method
User avatar (0020887)
midgardtech (reporter)
2009-02-18 19:08

Okay. Looks like it is set to DATABASE. I guess I should try changing it to FILE and try again.
User avatar (0020888)
midgardtech (reporter)
2009-02-18 21:11

Alright, I changed it to DISK and tried again with the same results.
User avatar (0020889)
midgardtech (reporter)
2009-02-18 22:04

Okay, I have been doing a little more research. I have found, that if I send in a file attachment, nothing seems to get parsed. Nothing gets added to the ticket as a description, nor does the attachment get added to the ticket. Is it the parser? Where does the $g_mail_html_parser variable go? I added it to the config_inc.php file as I did not see it in any of the files included with the plugin.

I have tried sending it as both an html mail and a plain text mail and the results are the same. With an attachment, I get no description or attachment. Without the attachment, it works fine.

Let me know if there is any way I can help. Oh, the install is a virgin 1.2.0a3 install with just this plugin.
User avatar (0020890)
joshua_chan (reporter)
2009-02-18 22:16

I downloaded, and applied recmail.patch to get it to work under linux. I had two issues:
 - replying to a Mantis email always created a new ticket, rather than adding a bugnote
 - file attachments did not work

Made a few minor changes to get it to work better for me. I have uploaded them as "recmail_reply_attach.patch". I hope it helps.
User avatar (0020891)
brody (reporter)
2009-02-19 04:34

@cas - reg. your note 0004286:0020883 - a good idea, but IMO from my experience incomplete, because checking this text is not always possible. In the tense of HTML-mails, this text is sometimes not used (and further more I'm german with same contacts). Resulting that I check following:
> -----Original Message-----, -----Original Message-----, From: then the german complements: > -----Ursprüngliche Nachricht-----, -----Ursprüngliche Nachricht-----, Von: . If that does not fit, a language independent form: ________________________________ (underscore of 32 chars)

In newer mails sometimes I saw, that these checks also fails.
User avatar (0020895)
cas (reporter)
2009-02-19 08:01

I will include Joshua's patch and make fresh version available.
As for note of Brody, in this plugin the search string can be defined.
If you have the bug-report mail to start with a special (set of) characters, you still can eliminate the rest of the mail
User avatar (0020905)
remko (reporter)
2009-02-20 03:29

@cas - reg. your note 0004286:0020883: What I did was check for the original "$g_from_name" and cut the message there. Not ideal, but better than checking for -----Original Message----- in my experience.
User avatar (0020906)
remko (reporter)
2009-02-20 03:41

I have a nasty problem with "Mail/mimeDecode.php".
In our system we use long urls with numbers in them. Like this one: [^]

If users have a bug on a page like that and mail it to Mantis the mimeDecode.php destroys this url. How? Well, via the function _quotedPrintableDecode, line 609:

$input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input);

Somehow it seems IF there's a number behind the "equals" sign (=) in de body of the mail, this gets translated into HEX. But we don't want that! I've tried to out comment this function but ran into the problem that the page does not finish anymore failing to delete the mails on the server. So that did not work. Anyone have a suggestion on how to fix this?
User avatar (0020907)
brody (reporter)
2009-02-20 04:46

@remko: I noticed this behaviour too - sometimes and on an elder installation of mantis. I tried to find out, where the problem is and I guess this happens on the fact, that the decoding is called twice from the mail processing.

Maybe that hint helps - I've currently no time to provide a fix for that, but someone else could maybe.
User avatar (0020908)
remko (reporter)
2009-02-20 06:50

@0020906 the following code seems to fix this problem (but only for http urls, so this code could be improved):

if (strpos($input, 'http://' [^]) === false){
$input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input);
User avatar (0020909)
cas (reporter)
2009-02-20 08:13
edited on: 2009-02-20 08:41

Attached version 0.95, have taken into account mentioned issues.
Please remove old plugin before installing this one.

Please use, initial one contains a bug. Unfortunately I am not allowed to remove.

User avatar (0020914)
midgardtech (reporter)
2009-02-20 21:35

Hi, the bugnotes issues works now. I still can't send attachments, however. I am using Ubuntu Linux. If there is anything else you need from me, let me know.
User avatar (0020917)
cas (reporter)
2009-02-21 11:39

Is there an error message?
Did you create the directory for "Directory for saving temporary mail content" as listed within the config?
Have tested this with DISK and DATABASE and all seems to work fine.
Only downside here is that my tesrsite is based on Windows
User avatar (0020947)
tanky (reporter)
2009-02-26 04:48


Thanks for this helpful plugin. I use MantisBT 1.2.0a3 and have one issue to make it working. I can't add a Mailbox through 'Maintain POP3 Settings' and get an error: "SYSTEM WARNING: mysql_fetch_row(): supplied argument is not a valid MySQL result resource". Do you have any idea about the solution? Thx
User avatar (0020957)
cas (reporter)
2009-02-26 22:13

has the table (mantis_plugin_recmail_pop3_table) been created ok?

if not, execute this sql on the DB:
CREATE TABLE IF NOT EXISTS `mantis_plugin_recmail_pop3_table` (
  `mailbox_id` int(10) unsigned NOT NULL auto_increment,
  `mailbox_name` varchar(50) default '',
  `project_id` int(10) unsigned NOT NULL,
  `category_id` int(10) unsigned NOT NULL,
  `pop3_host` varchar(250) default '',
  `pop3_user` varchar(250) default '',
  `pop3_pass` varchar(250) default '',
  PRIMARY KEY (`mailbox_id`)
User avatar (0020958)
tanky (reporter)
2009-02-27 08:44

Thanks this table wasn't there. Also I modified my due_date column in Mantis_Bug_Table from datetime to VARCHAR as I had wrong value (-3599) in INSERT query.
User avatar (0020960)
cas (reporter)
2009-02-28 01:35

Not sure what that fiedl has to do with this plugin. Nevertheless I do not believe that you should change that. My register plugin certainly expects that field to be 'timedate' format. Suggest to open another issue for that problem.
User avatar (0020987)
remko (reporter)
2009-03-03 05:39

@cas: I will try your plugin on our test system. On our live system we're still using the "old" nonplugin version of this function. We found that we also have a "attachment issue" like midgardtech (@0020914). In Mail/mimeDecode.php we put in:
if (strpos($input, 'http://' [^] [^]) === false){
$input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input);

that did fix the "broken url" problem, but gave us a new problem: mails with attachments do not get parsed properly any more (and won't be deleted from the server). I quess we have to fix this at the root of the problem. That could be as brody (@0020907) suggests that the parsing is called twice.

Do you know if your plugin fixes this broken-URL problem?
User avatar (0020995)
remko (reporter)
2009-03-04 08:50

@cas. We are having the same problem as you mentioned @18044 : long URLS get broken. We are only having this problem with incoming HTML-mail. Plain TEXT mails are fine. Did you ever fix this problem?

N.B. Not only the URLS are "cut" at a certain point, but also the rest of the text. So I would suspect a "truncate" of "wrap" variable somewhere, but I can't seem to find it. I quess the problem is somewhere in the /Mail/mimiPart.php. But where?
User avatar (0021013)
joshua_chan (reporter)
2009-03-08 03:19
edited on: 2009-03-09 01:05

This plugin has been working well for us now on Linux using the DATABASE method. I made several more edits since the last time. The only major addition is the option to reject unknown incoming emails. (See "reject-mail.patch", applied to "")

 - Changed the "Auto Signup" option into "How to handle unknown email addresses". It is possible now to reject incoming emails if they don't match a registered user.
 - Fixed double notification emails when a bugnote was added to existing issues.
 - Changed default email of 'Mail' user from "" to ""
 - Increased "POP3 host" textbox size from 30 to 50 characters.
 - Added "plugin_push_current( 'Recmail' );" to bug_report_mail.php so it can be included directly from another PHP script without passing through plugin.php.

I also renamed "Recmail_api.php" to "recmail_api.php" for Linux, though this change isn't in the patch.

[edit: We use DATABASE, not DISK. Sorry.]

User avatar (0021021)
cas (reporter)
2009-03-10 09:47

Will implement most of these into the next version, always could to add some more functions.

have not been able to do anything about that one. First wouyld like to have this plugin more or less approved.
User avatar (0021073)
ecik (reporter)
2009-03-18 05:00

We've got a problem with attachments which names contain a Umlaut. Those mails do not get parsed properly and therefore there won't be deleted from the Server.

Has anybody an idea how to fix that?
User avatar (0021094)
cas (reporter)
2009-03-18 09:24

Perhaps by adjusting the name of the attachment by using a function like:
function strip-Accents($string){
return strtr($string,'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ',

Now look at function 'function mail_add_file' inside Recmail_api.php.
Replace this line :
$t_file_name = plugin_config_get( 'mail_tmp_directory' ) . '/' . $p_part['name'];

with :

$t_file_name = strip-Accents(plugin_config_get( 'mail_tmp_directory' ) . '/' . $p_part['name']);

Do not forget to add this function (strip-Accents) to the same script.
User avatar (0021098)
ecik (reporter)
2009-03-18 10:27

Thank you for your answer!
Unfortunately this didn't work. I'm getting an Application Error 0000401. I think the Problem is the Character Setting of a mail which contains Umlauts in the name of an attachment.
I tried to debug it and the result is:

["X-Mantis-Body"]=> string(34) "die ist mal wieder ein Umlauttest." ["X-Mantis-Parts"]=> array(1) { [0]=> array(3) { ["ctype"]=> string(10) "text/plain" ["name"]=> string(8) "t?st.txt" ["body"]=> string(31) "Dies ist ein test. bla bla " } } ["Priority"]=> int(30) ["X-Mantis-Complete"]=> NULL }

The mail I sent looked like this:

This is a multi-part message in MIME format.
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

die ist mal wieder ein Umlauttest.

Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;

Dies ist ein test.
bla bla

The Problem is that the filename comes as filename*=ISO-8859-15''%74%E4%73%74%2E%74%78%74
Filenames which doesnt contain Umlauts are normaly coded like this:
I think this little difference causes the problem. But I've got no Idea how and where to fix that.
User avatar (0021103)
midgardtech (reporter)
2009-03-18 14:57

Hi ... Been a while since I posted my problem with attachments, but I am still getting it. Anytime I send an email with an attachment, Not only do I not get the attachment in the bug but I also do not get a description. Without the attachment it works just fine.

I ran the lynx method of forcing the pop3 check which works. But I do not see any errors. I tried running the command line php version and get this message:

Could not open input file: /var/www/plugin.php?page=Recmail/bug_report_mail.php

Is there anywhere I can look for errors? I did check apaches error.log but found nothing.

User avatar (0021198)
cas (reporter)
2009-03-26 05:45
edited on: 2009-03-26 05:58

As for the umlauts, will try to do some additional testing, to see if it can be fixed.
As for not getting the attachments, I really have no clue. Sofar it seems to be working fine. I do not have an Ubuntu testbox (but perhaps finds time to build one in the future). The only way is to use a PHP debugging tool to see what happens, or you work you way through the script step by step using echo/die statements etcetera to find out what happens.

User avatar (0021199)
cas (reporter)
2009-03-26 05:54
edited on: 2009-03-27 12:57

Question for the community, currently when receiving an email, the system will try to add it as a note to an existing issue. However this will only happen if the status of this issue is below the "bug_readonly_status_threshold".
If it is equal or higher, nothing happens (actually the mail gets lost).
What todo?
Should the condition be removed?
Should the issue be reopened ?
Should in those cases a new issue be created?

For now, the next version of the plugin will raise a new issue.

User avatar (0021302)
midgardtech (reporter)
2009-03-30 18:15

Unfortunately, I don't know a think about php or programming. You say you are running the software on a windows box? Are you running wamp or xamp or anything like that? I will try to set this up on a windows box to see if things run differently.

User avatar (0021396)
cas (reporter)
2009-04-05 11:56

I am running Xampp and running IIS
User avatar (0021405)
ingvald (reporter)
2009-04-06 16:13
edited on: 2009-04-06 16:16

fyi, in case it's not been addressed yet: fix on non-ascii characters.

i'm playing around with an older version (unofficial something, meant for 1.1.1 i think, and i have mantis 1.1.6).

to get nordic characters i had to add utf8_encode in mail_parse_content, to get a couple of lines as follows:
$t_mail['Subject'] = utf8_encode( $t_mp->subject() );
$t_mail['X-Mantis-Body'] = utf8_encode ( $t_mp->body() );

seems to work fine with norwegian characters.

User avatar (0021434)
DGtlRift (reporter)
2009-04-08 10:10

Is the [^] supposed to contain the code for this plugin? I ask, because the head is empty at all the referenced mirrors, but I can't say anything about the push url.
User avatar (0021446)
grangeway (reporter)
2009-04-08 12:32

It would be nice to get it on there - iirc, when i've looked at these patches before, they dont change the core api's so a plugin would be good. If there is a problem accessing the repository that was created, whoever created it - drop me an email and i'll see if we can get it working.

User avatar (0021450)
Nosos (reporter)
2009-04-09 04:06

Hello people,

we had the exact same problem as described by ecik.
E-mails with attachments that containted umlauts could not be processed.

I traced down the problem to the function file_is_name_unique in the core/file_api.php.

It is the sql-query:
$query = "SELECT COUNT(*) FROM $t_file_table WHERE filename='$c_name' and bug_id=$c_bug";
It can't cope with Umlauts.

A possible solution is to change the name of the file beforehand:
#Old Version:
#$c_name = db_prepare_string( $p_name );
#New Version:
$c_name = utf8_encode(db_prepare_string( $p_name ));

Our tests have shown, that this helps with german umlauts, but not nessecarily with every kind of special character (which are not found in the german language).

I'm wondering if this function is really needed. As far as I understand it, it's there to see if there is already an existing file with the same name attached to the issue. If yes, it will be renamed, using a additional number in front of the name (i.e. filename.txt => 1_filename.txt).
In our workflow we don't have a scenario where this would apply.

Anyway, hope I could help.
User avatar (0021516)
ecik (reporter)
2009-04-14 08:29
edited on: 2009-04-16 06:09

the solution that Nosos posted worked for us.
@nosos: THANK YOU!!!

We are able to test it for other umlauts, too. Not only for german. I will post if any further problems with special characters appear.

User avatar (0021571)
Nosos (reporter)
2009-04-16 05:16
edited on: 2009-04-16 05:37

Glad I could help.

Here an additional note: If this fix is not working for your special characters, be it norwegian or hindu for example, you could try just replacing those signs using str_replace() or one of the other functions that php offers.

As the very last solution you can disable this check completly. As I said before, we don't really have a scenario, where we would need this verification.
We only use e-mails to insert new issues, not to alter existing ones.

User avatar (0021721)
DaVinci (reporter)
2009-04-29 05:47

I get a question mark ( ? ) instead of norwegian charaters when i report a case via mail.
I have tried to change line 189 in file .\..\mantis\Mail\mimePart.php

isset($contentType['charset']) ? $contentType['charset'] : 'US-ASCII',
isset($contentType['charset']) ? $contentType['charset'] : 'UTF-8',

and line 205 from:
isset($contentDisp['charset']) ? $contentDisp['charset'] : 'US-ASII',
isset($contentDisp['charset']) ? $contentDisp['charset'] : 'UTF-8',

and line 400-402:

// } elseif ($charset && (strtolower($charset) != 'us-ascii')) {
            } elseif ($charset && (strtolower($charset) != 'utf-8')) {
            $shouldEncode = 1;
        //} elseif ($language && ($language != 'en' && $language != 'en-us')) {
          } elseif ($language && ($language != 'en' && $language != 'nb-no')) {

but i still get questionamrk instead of norwegian chracters.

Can nayone help me here please.
User avatar (0021727)
ecik (reporter)
2009-04-29 09:09

I think the lines which ingvald postet a few weeks before could help (Note number 0021405 ):

to get nordic characters i had to add utf8_encode in mail_parse_content, to get a couple of lines as follows:
$t_mail['Subject'] = utf8_encode( $t_mp->subject() );
$t_mail['X-Mantis-Body'] = utf8_encode ( $t_mp->body() );
User avatar (0021772)
DaVinci (reporter)
2009-05-04 04:00

that didnt help :(
User avatar (0021781)
jojow (reporter)
2009-05-06 07:39
edited on: 2009-05-06 07:52

I'm testing recmail095a with mantisbt 1.2.0a3
(Windows Server 2003, Apache Server 2.2, mysql 5.1.23, PHP 5.2.5)

when I start the automation "... php.exe plugin.php?page=Recmail/bug_report_mail.php ..." as found in the readme.txt i get following Error:
"The procedure entry point DrawRectangle could not be located in the dynamic link library CORE_RL_magick_.dll."
I have "ImageMagick-6.5.2-1-Q16-windows-dll.exe" new installed, but it didn't help? Where is the mistake?

User avatar (0022061)
Devslashnull (reporter)
2009-06-08 17:40

That worked for me. Thanks for the post.

What collation are you using? Ours worked since we were using utf8_general_ci. I would confirm your DB is using a UTF-8 collation if not I would try confirming if that makes a difference or not.

User avatar (0022232)
DaVinci (reporter)
2009-06-23 03:12

i've created a gmail address: i want to use that to retrive all the mail from..but when i go to ../bug_report_mail.php i get the follwoing error:

error:abc [pear_error: message="Generic login error" code=1 mode=return level=notice prefix="" info=""]

the settings are.

POP address:
password: abc_gmail_com

can anyone please help
User avatar (0022233)
Woefdram (reporter)
2009-06-23 03:33

@DaVinci: you should fiddle a bit with the authentication method. I had the same problem with Exchange, turned out it worked just fine when I chose "user" there.
User avatar (0022234)
cas (reporter)
2009-06-23 03:35

please verify the mail authentication method
User avatar (0022250)
DaVinci (reporter)
2009-06-23 16:36

@Woefdram and @cas
# The auth method used for POP3
# Valid methods are: 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'
$g_mail_auth_method = 'USER';

i've fiddled with the authentication but it didnt help
User avatar (0022251)
Devslashnull (reporter)
2009-06-23 16:46

I probably would not test with a Gmail account. Gmail uses port 995 for POP3 access, [^]

I would suggest changing the port from 110 which is the standard POP3 port to 995 if you really want to try it out with Gmail.

User avatar (0022253)
DaVinci (reporter)
2009-06-24 04:32

@Devslashnull a.k.a. Jack

I didnt understand that
first u say that u wouldnt try it with a gmail account since gmail uses port 995
then you provide a link that takes me to the thunderbird settings for gmail
and then u say that i've to change the port from 110 to 995
User avatar (0022263)
Devslashnull (reporter)
2009-06-25 14:09


Don't use Gmail to test unless you want to make changes to the code. I gave you the link for Thunderbird to show you that Gmail does use port 995 and not 110.

If you still want to use Gmail to test then you need to update the code to use port 995 instead of 110. If you are using other accounts that don't use port 995 then you will have to make a fair amount of changes to the code base in order to support POP3 accounts using port 110 and those using 995.

Hope that clears things up.

User avatar (0022264)
Devslashnull (reporter)
2009-06-25 14:15
edited on: 2009-06-25 14:25

@Brody c0020317

You mentioned that you had found a solution for your own implementation for processing text documents for an email and that you made several code changes to Parser.php.

Any chance you can provide us with the changes you made so I can configure it for the setup I am working with? Also it seemed like you indicated a change had been implemented but I am using the code from but am still encountering the problem.

Any insight would be appreciated.


User avatar (0022266)
DaVinci (reporter)
2009-06-26 02:14

what about LotusNotes and phpMail?
User avatar (0022268)
Devslashnull (reporter)
2009-06-26 09:19


Not sure what you want to know about LotusNotes and phpMail. I've never user LotusNotes so I can't say anything about it.

User avatar (0022269)
DaVinci (reporter)
2009-06-26 09:28

do u know about anyother mail servers that i can use with mantis without doing any changes in code
if i want to use gmail..where do i need to do changes?
User avatar (0022270)
cas (reporter)
2009-06-26 11:40

Will build this option in next version such that you can specify by entry.
User avatar (0022437)
desjardm (reporter)
2009-07-07 09:44

Hello all,

I got this error with this plugins
Fatal error: Call to undefined function bug_create() in /var/www/ on line 316

Did I miss something !!!!


Debian Etch
Deb package installed php-pear

Recmail_api.php need to be renamed to recmail_api.php (or only a symbolic link)
r vs R ... maybe just a typo cause rest of script call it with small r.

reject-mail.patch is not a patch ... =)
I made one with this original diff file (someone need it ?)

Here the result
[root@colline:plugins/Recmail]# patch -p1 < reject-mail-mod.patch
patching file Recmail.php
patching file Recmail_api.php
patching file lang/strings_english.txt
patching file pages/bug_report_mail.php
patching file pages/checkuser.php
patching file pages/config.php
patching file pages/config_edit.php
patching file pages/setpop.php
User avatar (0022569)
SL-Gundam (reporter)
2009-07-27 14:33
edited on: 2009-07-27 19:17

Hi everyone

I saw that cas already created a plugin for MantisBT-1.2.0

But it didn't work that well for me, mainly because he was directly referencing mysql_query functions and i was using mysqli.

But i also made some small modifications to this script which i never uploaded here as can be seen from the changelog.

In the end i created my own version of the plugin and incorporated as much as possible from cas's ideas. I hope he doesn't mind.

I hope it works well for everyone.

Here is my changelog
Jul 2009
- Modified script to the new plugin architecture of mantis 1.2.0rc1
- This script no longer needs new fields created in the database. This allows installation on mantis configurations where the database user only has select, insert, update and delete rights
- custom_file_api.php has been updated to reflect the changes in its original Mantis counterpart
- Cleaned up functions and files that were no longer usefull and / or necessary
- Script did not use the default severity and default reproducibility for new bugs, it does now
- New setting called secured_script to protect it from running on a webserver. Uses the same method as the send_emails.php job
- File types that are not allowed will now be properly skipped during processing of attachments in emails so that it doesn't cause further errors down the line
- mail_additional config setting is now called mail_add_complete_email and saves the complete email as an attachment .txt document instead of in the "Additional information" field
- replaced html2text 1.2 (phphtmlparser) with simplehtmldom 1.11 from [^]
- Names of attachments will now also be processed by mbstring to convert the character encoding. The content of the attachment does not need to be processed since its stored as binary
- Parser will try the content-disposition field and the content-type field for a name if the name seems to be missing. As a fallback a alternative name will be provided incase of attachments of type email
- Added support to use a different port for the pop3 server.
- A lot of rewrites for the processing in parser.php and mail_api.php. It should now process all attachments properly
- Reversible encryption will now be applied to the mailbox password
- Updated the user information inside bug_report_mail.sql. This file is useless now though since the adding of the user is handled by the plugin
- php.ini var upload-tmp-dir no longer used, the script will use the config mail_tmp_directory for temporarily saving attachments
- html parsing no longer requires the file to be physically saved. mail_tmp_directory no longer needed here
- The Mail Reporter user will now be filtered out of the email system as long as he has "nomail" as a email address
- Identifying bugnotes works again
- New function which removes automatic mantis emails from bugnotes
Dec 2008
- Scipt made compatible with Mantis 1.1.6
Sep 2008
- Check whether php.ini var upload-tmp-dir is empty to avoid attachment problems
Aug 2008
- Applied a character encoding conversion on incoming emails.
- New setting in config_defaults_inc.php called $g_mail_encoding (values can contain supported values for this function: [^])

User avatar (0022573)
cas (reporter)
2009-07-28 06:50

Thanks SL-Gundam, good to see the plugin has reach an even higher level. Will be testing this shortly.
User avatar (0022599)
desjardm (reporter)
2009-07-29 08:27

Just tested with success.
Thank for this upgrade.

Is there a way to control the reply message?
We use french tag here.

Thanks again.
User avatar (0022601)
SL-Gundam (reporter)
2009-07-29 14:32
edited on: 2009-07-29 14:43

What do you mean control the reply message?

I know there is currently a bug where mantis 1.2.0rc1 sends emails to users in only its Global language (normally english) and not that of the users its sending to.

Maybe thats what you mean?

Btw i'm currently updating this script again with a feature that was requested on this page but i apparently missed. When a new user needs to be registered automatically it will try to use the senders name as the username. If this fails it will use the email address as a username

Look forward to it

User avatar (0022621)
SL-Gundam (reporter)
2009-07-30 18:21
edited on: 2009-07-30 18:24

As mentioned earlier here is the small update

Aug 2009
- The script now also recognizes a possible name in the from part of emails. It uses this as the username during the creation of the user
- Cleaned up some more useless files that were not used
- User creation during the installation of the plugin is now handled by mantis api's, schema functions no longer needed.

I think this will be the stable release for a while unless i think of something new to change... but i'm out of ideas and can't find anymore in this issues bugnotes.

User avatar (0022655)
remko (reporter)
2009-08-04 07:29

@SL_Gundam: first of all: thanks 4 this plugin!
I've got a problem with the password setting though. The "Mailbox password" setting is encrypted I think, but on my server it does not get decrypted when checking the mail. Is there another setting I missed to do that?
User avatar (0022657)
SL-Gundam (reporter)
2009-08-04 11:12
edited on: 2009-08-04 11:18

I checked but it properly decrypts it right before it wil try to connect to the pop3 server

But i did find a bug in MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.rar (0.5 didn't have this problem) where if you edited a mailbox, that it would not decrypt before editing. Upon saving it would encrypt it on top of the already encrypted password

Fixing this now. Should be a new version in about 30 mins

User avatar (0022659)
SL-Gundam (reporter)
2009-08-04 12:07

Here is the changelog for (MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.1.rar)

Aug 2009 v2
- bug_report_mail.sql has been removed to avoid confusions about needing to use it
- Decrypting the mailbox password did not occur before editing. Fixed (Note 0004286:0022655)
- A new variable is added which resets the plugin schema and fixes the Mail Reporter user when it has the email address "nomail" (Automatically done during the first initialization of the plugin)
- Removed functions which performed the exclusion of emails to Mail Reporter with "nomail" mail address