Email Reporting Plugin Setup HOWTO

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Developer, Contributor

newmantisuser
Posts: 68
Joined: 06 Aug 2012, 18:13

Email Reporting Plugin Setup HOWTO

Post by newmantisuser »

I posted this under the 'first steps' thread but thought it might warrant it's own thread.

enjoy


-------------

First of all make sure you have the CORRECT gmail settings. You can also turn on DEBUG MODE in the email plugin configuration settings to see more information if the script is failing to add an entry to your mantis database.

Here are the gmail settings that worked for me

Description: Gmail test
Mailbox Type: pop
Hostname: pop.gmail.com
Tcp port (optional): left blank
Connection encryption: ssl
Username: xxxx@gmail.com --> make sure you have the @gmail.com entry or else it does not work
Password: the password for the gmail account you setup
Authentication user: USER

Once you have all that setup, send an email to your account and run the script /path/to/plugins/EmailReporting/scripts/bug_report_mail.php from your web browser. Make sure you setup the script to run from the web browser (set to no by default) just to test..once everything is working correctly you should set this back to NO and use the following script instead.

create the file mantisemailcheck.sh and add this into it, make the script executable and then run it.

# !/bin/bash
/path/to/php/bin/php /path/to/plugins/EmailReporting/scripts/bug_report_mail.php

the /path/to/php/bin/php is the path to the actual 'php' executable. You should see output like this if you run the script from your terminal


Mailbox: INITIALIZATION PHASE
Message: Debug output memory usage
Location: Mail API - Finished __construct
Current memory usage: 9.36 MiB / -1
Peak memory usage: 9.36 MiB / -1
Current real memory usage: 9.5 MiB / -1
Peak real memory usage: 9.5 MiB / -1

array(12) {
["enabled"]=>
bool(true)
["description"]=>
string(16) "Gmail Email Test"
["mailbox_type"]=>
string(4) "POP3"
["hostname"]=>
string(19) "ssl://pop.gmail.com"
["port"]=>
int(995)
["encryption"]=>
string(3) "SSL"
["username"]=>
string(22) "xxx@gmail.com"
["password"]=>
string(16) "MXFhejJ3c3dsfadfaUUSJgjRURD"
["auth_method"]=>
string(4) "USER"
["project_id"]=>
int(7)
["global_category_id"]=>
int(1)
["link_rules"]=>
array(1) {
[0]=>
int(1)
}
}


Mailbox: Gmail Email Test
Message: Debug output memory usage
Location: Mail API - Start process mailbox
Current memory usage: 9.37 MiB / -1
Peak memory usage: 9.37 MiB / -1
Current real memory usage: 9.5 MiB / -1
Peak real memory usage: 9.5 MiB / -1

Once you have that working, you setup a cronjob to make the script run every X minutes. I have mine setup to run every 5 minutes.

crontab -u root -e
5,10,15,20,25,30,35,40,45,50,55,59 * * * * /root/backup_scripts/mantisemailcheck.sh

Once mail has arrived to your Gmail account you will see this in your script output

Mailbox: Gmail Email Test
Message: Reporter: 79 - xxxx@xxx.com --> Issue ID: #756

Mailbox: Gmail Email Test
Message: Debug output memory usage
Location: Mail API - Finished add bug
Current memory usage: 9.86 MiB / -1
Peak memory usage: 9.9 MiB / -1
Current real memory usage: 10 MiB / -1
Peak real memory usage: 10 MiB / -1

that shows a new entry with ID# 756. It should be at the top of your 'view issues' page in mantis.

Now lets discuss the Email Plugin Configurations
Log into Mantis as an admin and go to Manage -> Manage Plugins -> Email Reporting 0.9.0-DEV
http://mantis/mantis/plugin.php?page=Em ... age_config

- Set Block this script from running via a webserver (recommended = "Yes") = YES once you have everything working correctly
- Maximum fetched emails per mailbox per execution of the scheduled job = 1
- Delete processed email from the mailbox = Yes I set this as Yes because it seemed as though every time the script checked for new mail, it would keep adding
the old entries into Mantis over and over. Test this yourself but once I set this option to "Yes" the issue went away.
- Use only default reporter user for issues created by email = NO I set this option to NO here so that individual users would be able to send email into the system under their username and it would show up as user "jdoe" instead of the default "mailerxxxxx"
- Create new issues = Yes
- Add notes = Yes
- Rule system = NO (this has not yet been implemented)
- Parse HTML emails = Yes
- Remove MantisBT notification emails from replies = Yes
- Remove all replies from notes = Yes
- Should users receive emails for their own actions (N/A if email_receive_own = ON) = Yes I set this to YES so that users will receive an confirmation email with bug ID Number so that they know their entry was successfully submitted into Mantis.
- Write the sender of the email into the issue report/note = Yes
- Write the subject of the email in the note = NO
- What kind of search should be used to find the issue id in the subject = STRICT
- Write the subject of the email in the note = NO
- Add the complete email into the attachments = NO

Here are the settings for the Manage Mailboxes options
http://mantis/mantis/plugin.php?page=Em ... ge_mailbox

Email Reporting: Mailbox issue settings
- Select a project = Email Queue (you will have to create this Project before hand so it shows up in the list. This is the project that the emailed mantis entries show up in. From there, you will have to manually move to the correct project or assign to the proper individual.)
- - Select a category = General This is the default "Category" that the emailed entry shows up in, in Mantis.

That's all for now. Good luck.
Last edited by newmantisuser on 22 Jan 2013, 13:09, edited 4 times in total.
Lisandro1987
Posts: 19
Joined: 02 Oct 2012, 13:56

Re: Email Reporting Setup HOWTO

Post by Lisandro1987 »

Excelent thread! Thanks so much!!!

I have a problem. When I run the script '/plugins/EmailReporting/scripts/bug_report_mail.php' from my web browser the next message appear:
Start checking all mailboxes: Friday 2nd of November 2012 15:38:41

Mailbox: Gmail test
Message: Upload folder is not writable: /home/tracker4/tracker_files

Done checking all mailboxes
This folder do not exist. Where can I change this path?
newmantisuser
Posts: 68
Joined: 06 Aug 2012, 18:13

Re: Email Reporting Setup HOWTO

Post by newmantisuser »

Hummm. I'm not sure. That path must be defined somewhere. Weird....Does the mail show up in your Mantis bug tracker once you send mail to the address you specified?

Does that /home/tracker4/trackerfiles directory mean anything to you? Does it exist on your system?

In the email plugin configuration turn on debug mode and then run the script again from the browser and paste the results in here. It should look like the following.

Start checking all mailboxes: Friday 2nd of November 2012 14:08:28



Mailbox: INITIALIZATION PHASE
Message: Debug output memory usage
Location: Mail API - Finished __construct
Current memory usage: 18.22 MiB / 128M
Peak memory usage: 18.29 MiB / 128M
Current real memory usage: 18.5 MiB / 128M
Peak real memory usage: 18.5 MiB / 128M

array(12) {
["enabled"]=>
bool(true)
["description"]=>
string(20) "Mantis Email Account"
["mailbox_type"]=>
string(4) "POP3"
["hostname"]=>
string(24) "ssl://owa.xxxxx.net"
["port"]=>
int(995)
["encryption"]=>
string(3) "SSL"
["username"]=>
string(23) "mantis@xxxxx.com"
["password"]=>
string(8) "bWFudGlz"
["auth_method"]=>
string(4) "USER"
["project_id"]=>
int(35)
["global_category_id"]=>
int(1)
["link_rules"]=>
array(0) {
}
}


Mailbox: Mantis Email Account
Message: Debug output memory usage
Location: Mail API - Start process mailbox
Current memory usage: 18.23 MiB / 128M
Peak memory usage: 18.29 MiB / 128M
Current real memory usage: 18.5 MiB / 128M
Peak real memory usage: 18.5 MiB / 128M



Mailbox: Mantis Email Account
Message: Debug output memory usage
Location: Mail API - Finished process mailbox
Current memory usage: 18.24 MiB / 128M
Peak memory usage: 18.29 MiB / 128M
Current real memory usage: 18.5 MiB / 128M
Peak real memory usage: 18.5 MiB / 128M



Done checking all mailboxes
Lisandro1987
Posts: 19
Joined: 02 Oct 2012, 13:56

Re: Email Reporting Setup HOWTO

Post by Lisandro1987 »

I resolved the problem. Thanks you! But I'm having an other problem. If you want I write the description here: http://www.mantisbt.org/forums/viewtopi ... 13&t=20857
newmantisuser
Posts: 68
Joined: 06 Aug 2012, 18:13

Re: Email Reporting Setup HOWTO

Post by newmantisuser »

Check this option in the email reporting plug-in.

All the way down to the bottom there is this entry
"Add the complete email into the attachments [?]" I have this set to NO

Is that what your looking for....actually i'm thinking not..

I'm not sure what you would have to edit to remove those last 3 lines
Lisandro1987
Posts: 19
Joined: 02 Oct 2012, 13:56

Re: Email Reporting Setup HOWTO

Post by Lisandro1987 »

Thanks so much for your reply!

But I had this option chosen :(
Add the complete email into the attachments [?]: No
If you want, we follow this in:

http://www.mantisbt.org/forums/viewtopi ... 13&t=20857

Thank you again!
itacoder
Posts: 6
Joined: 16 Jan 2013, 16:07

Re: Email Reporting Setup HOWTO

Post by itacoder »

hey there! i would like to know which information mantis want to get to create a valid ticket by email reporting.
please excuse that ive only replied to this post but im not native english and 'm not able to use the search properly...


thx4help
itacoder
newmantisuser
Posts: 68
Joined: 06 Aug 2012, 18:13

Re: Email Reporting Setup HOWTO

Post by newmantisuser »

itacoder wrote:hey there! i would like to know which information mantis want to get to create a valid ticket by email reporting.
please excuse that ive only replied to this post but im not native english and 'm not able to use the search properly...


thx4help
itacoder
Hello,

Mantis does not need much information to create a ticket automatically via email. The SUBJECT of the email is the SUMMARY in mantis so keep that in mind. I would just test by sending an email to the email address defined and see what the entry looks like once the system receives the emailed entry.

All you have to do is define an email address (as instructed above) and once email has been sent to that address, the check email script will probe the mail server and if there is mail, it will deliver it to a specific project in mantis (I setup a project called 'Incoming Email Queue' and emailed entries end up there.) You can define a bunch of email settings in the mantis email plugin configuration page.

Hope this helps
ZiZou1991
Posts: 23
Joined: 21 Jul 2014, 12:12

Re: Email Reporting Plugin Setup HOWTO

Post by ZiZou1991 »

please i don't understand this

the /path/to/php/bin/php is the path to the actual 'php' executable

Help!!
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Email Reporting Plugin Setup HOWTO

Post by SL-Gundam »

Yes to the actual php executable. Keep in mind that cronjob is something for linux systems. With windows you can just create the task in the task scheduler
ZiZou1991
Posts: 23
Joined: 21 Jul 2014, 12:12

Re: Email Reporting Plugin Setup HOWTO

Post by ZiZou1991 »

Thanks SL-Gundam,

Now, i receive mails as a bug from my mailbox, but any mail is retrieved whatever this subject
my question is how to filter mail and fill all the fields in rubric "report issue" by a mail with a particular format

thanks for helping me :)
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Email Reporting Plugin Setup HOWTO

Post by SL-Gundam »

I'm not quite following what you want but any options that are available are in Configuration options for this plugin and in a smaller decree in the mailbox options
ZiZou1991
Posts: 23
Joined: 21 Jul 2014, 12:12

Re: Email Reporting Plugin Setup HOWTO

Post by ZiZou1991 »

Dear SL-Gundam,

I mean that any mail sent to my mailbox is added as a bug (how to avoid spam!!)
then, to report issue there are some fields to fill such as Category, Reproducibility, Severity, Priority , assigned to ... So how to replace the default values created by mail and how to specify empty fields like "assigned to".

thanks again.
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Email Reporting Plugin Setup HOWTO

Post by SL-Gundam »

You avoid spam by using spam filters on your mail server if necessary. EmailReporting has no builtin solution

category can be set up in the mailbox configuration. Do you want issues to come in with different categories then you need to setup multiple email addresses with multiple mailbox configurations in EmailReporting
reproduciblity, severity etc. always will default values for new issues based on mantisbt settings
priority will be set to the priority of the email if you enabled that functionality
assigned to.... by default issues will be unassigned but mantisbt has auto assign functionality builtin in certain categories and such.
ZiZou1991
Posts: 23
Joined: 21 Jul 2014, 12:12

Re: Email Reporting Plugin Setup HOWTO

Post by ZiZou1991 »

Hi
category can be set up in the mailbox configuration. Do you want issues to come in with different categories then you need to setup multiple email addresses with multiple mailbox configurations in EmailReporting
I don't understand that
Can you give me some details it's still not clear!!
Post Reply