The current version of bug_report_mail support plain text and MIME
encoded e-mails via POP3 Mailaccounts with PEAR's Net_POP3 package.

bug_report_mail is able to recognize if mail is a reply to an already opened
bug and adds the content as a bugnote.

This plugin is build upon version 1.2.x of mantis and should be installed as any other plugin
No Mantis scripts or tabes are being altered.
It is expected that PEAR is part of your PHP installation.

The plugin allows full control over the importing of issues.
The admin section allows you set the global config and also to define various mailbox accounts, one for every Project/Category combination.
Passwords of the mailboxes are stored encrypted in the database.
Please verify the mailbox connection before actvationg Cron-job/Scheduled-task.

There are two ways to receive mail with bug_report_mail:
The secure (and default) way is to use a standard reporting user:
You can use a reporter account, for example 'Mail'.
The name for this reporter account you have to write in your config_inc.php file:
	$g_mail_reporter = "Mail";
and then, bug_report_mail must be informed to behave like this:
	$g_mail_use_reporter = ON;
In the admin section you can verify if this account exists, if not it will be created.
	
The other way is to signup new user accounts automatically.
For using this, you have to change this
	$g_mail_auto_signup     = OFF;
from OFF to ON.
Now, bug_report_mail will look for an user named like the mail's sender
or an user which mail adress is identical.
If no user is found, then a new account will be created.
The new user's name will be the mail address.


If you like to parse MIME encoded mails, (also requires PEAR)
Mail_Mime package and set
	$g_mail_parse_mime	= OFF;
from OFF to ON.

For parsing HTML mails, set 
	$g_mail_parse_html	= ON;
and set 
	$g_mail_html_parser
to a valid tool for dumping HTML contents ("/usr/bin/w3m -T text/html -dump")
Also, 
	$g_mail_tmp_directory
has to be a valid directory to handle write the temporary HTML files.

For debugging controls there is the switch
	$g_mail_additional	= OFF;
which puts the complete message into the Additional Information field,
if it is activated.

If you like to see what bug_report_mail.php is doing, set
	$g_mail_debug = ON;

If $g_mail_directory is a valid directory and also writeable,
the complete mails will be saved to this directory.

In this case you should decrease the amount of fetched messages via
	$g_mail_fetch_max	= 1;
because the mime decoding needs a lot of memory.

If you'd like to use the Mail Reporter but don't save the whole message for
making the sender's address available, set
	$g_mail_save_from	= OFF;
to ON.

If you don't want bug_report_mail.php to delete the mails from your POP3
server set
	$g_mail_delete = OFF;


With 
	$g_mail_auth_method
you may set the AUTH method for your POP3 server. Default is 'USER',
but 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP' are also possible

For using the priority of the mails for the bug priority, set
	$g_mail_use_bug_priority = ON;

The
	$g_mail_bug_priority_default = NORMAL;
is the default value for the priority of new bug entries.
(Currently hard-coded)


After this, bug_report_mail can be used via cron like this:

*/5 *   *   *   * lynx --dump http://mantis.homepage.com/plugin.php?page=Recmail/bug_report_mail.php
or via command line interface
*/5 *   *   *   * /usr/local/bin/php /path/to/mantis/plugin.php?page=Recmail/bug_report_mail.php
This line fetch bug reports from via POP3 every 5 minutes. 


You also can use a scheduled task under windows by calling a batch-file like:
REM *** this batch is running as a scheduled task under the ... Account ***
g:
cd \inetpub\wwwroot\mantis
php.exe plugin.php?page=Recmail/bug_report_mail.php


This addon is distributed under the same conditions as Mantis itself.

Gerrit Beine, August 2004 / Cas Nuy January 2009