Email Reporting Plugin Setup HOWTO
Posted: 27 Aug 2012, 17:22
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.
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.