EmailReporting issue link URL
Postby prash315 » Sep 01, 2017 8:52 am
Hi,
I have setup the plugin successfully. However, when Mantis creates tickets, the email that goes out is showing the URL as localhost instead of the correct domain and context. It looks something like this
A NOTE has been added to this issue.
======================================================================
http://localhost/view.php?id=182
This is similar to the email that gets sent when a user creates an issue manually. The URL looks correct in this case
A NOTE has been added to this issue.
======================================================================
http://hostname/mantisbt/view.php?id=182
Can you please suggest me some directions here to fix this? Appreciate your help
EmailReporting issue link URL
Moderators: Developer, Contributor
Re: EmailReporting issue link URL
I expect you've directed the scheduled job to something like http://localhost/plugins/EmailReporting ... t_mail.php
MantisBT decides on its path everytime its run so if you run it through the localhost url, you get this result.
You have 3 options
MantisBT decides on its path everytime its run so if you run it through the localhost url, you get this result.
You have 3 options
- Run bug_report_mail.php through the php command line
- Run bug_report_mail.php through the webserver like you do know but use the same URL a normal client would use, so don't use localhost
- Now for this option i'm not 100% sure about the results but you can open the config_inc.php of MantisBT and force $g_path to whatever you want. This could cause unforeseen issues and could also make it more complicated to move the installation to another url in the future
Re: EmailReporting issue link URL
I actually followed the documentation and used step 1 which is recommended. I had to unblock the script from running via webserver for option 2 and that worked fine.
Also for command line, this is my batch script
cd C:\xampp\htdocs\mantis\plugins\EmailReporting\scripts
php bug_report_mail.php
I am not sure I want to use option 2, but I dont think I have a choice.. Is that correct?
Thanks
Prashanth
-------------------------------------------------------------------------------------------------------------------------------------
Setting up a scheduled / cron job for EmailReporting
EmailReporting requires that a scheduled / cron job is set up so that it can periodically retrieve emails from mailboxes
In MantisBT 1.3.x access to the plugins folder is blocked through a browser. So of the methods shown below, method 1 should be used from the command line while method 2 should be used if your hosting environment accesses the job through a webserver
/mantisbt/plugins/EmailReporting/scripts/bug_report_mail.php
/mantisbt/plugin.php?page=EmailReporting/bug_report_mail
Also for command line, this is my batch script
cd C:\xampp\htdocs\mantis\plugins\EmailReporting\scripts
php bug_report_mail.php
I am not sure I want to use option 2, but I dont think I have a choice.. Is that correct?
Thanks
Prashanth
-------------------------------------------------------------------------------------------------------------------------------------
Setting up a scheduled / cron job for EmailReporting
EmailReporting requires that a scheduled / cron job is set up so that it can periodically retrieve emails from mailboxes
In MantisBT 1.3.x access to the plugins folder is blocked through a browser. So of the methods shown below, method 1 should be used from the command line while method 2 should be used if your hosting environment accesses the job through a webserver
/mantisbt/plugins/EmailReporting/scripts/bug_report_mail.php
/mantisbt/plugin.php?page=EmailReporting/bug_report_mail
Re: EmailReporting issue link URL
Command line:
Is there any reason you are not using command line? Doesn't it work? and if it does not work whats the problem you are running into?
On windows webserver i normally associate the php extension to the php.exe. After that i use task scheduler to run bug_report_mail.php directly like this: C:\xampp\htdocs\mantis\plugins\EmailReporting\scripts\bug_report_mail.php
Using the webserver:
Running through the webserver has disadvantages compared to command line. PHP through commandline has a longer runtime available and more memory. Memory is important as attachments can use quite a bit of it.
It does not matter whether you use localhost or the actual web address. You've already removed the protection to run the script. The only protection left is to use http://www.mantisbt.org/wiki/doku.php/m ... red_ipaddr
Why are you against option 2?
Is there any reason you are not using command line? Doesn't it work? and if it does not work whats the problem you are running into?
On windows webserver i normally associate the php extension to the php.exe. After that i use task scheduler to run bug_report_mail.php directly like this: C:\xampp\htdocs\mantis\plugins\EmailReporting\scripts\bug_report_mail.php
Using the webserver:
Running through the webserver has disadvantages compared to command line. PHP through commandline has a longer runtime available and more memory. Memory is important as attachments can use quite a bit of it.
It does not matter whether you use localhost or the actual web address. You've already removed the protection to run the script. The only protection left is to use http://www.mantisbt.org/wiki/doku.php/m ... red_ipaddr
Why are you against option 2?
Re: EmailReporting issue link URL
The command line/task scheduling works perfectly fine. The issue is with the email that goes out to everyone. It contains an invalid link to the issue.
I tried the webserver path and that worked fine too. I was against option 2 because the documentation says not recommended. I also thought it might have security vulnerabilities, due to the fact that there is no authentication required as such. But, if I use mail_secured_ipaddr I guess we can get around that.
I want to check if anybody else has reported the issue with issue links in the email when running from command line, or is it just me due to some incorrect configuration.
Thanks
Prashanth
I tried the webserver path and that worked fine too. I was against option 2 because the documentation says not recommended. I also thought it might have security vulnerabilities, due to the fact that there is no authentication required as such. But, if I use mail_secured_ipaddr I guess we can get around that.
I want to check if anybody else has reported the issue with issue links in the email when running from command line, or is it just me due to some incorrect configuration.
Thanks
Prashanth
Re: EmailReporting issue link URL
EmailReporting caches the URL and uses that when run through the commandline and therefore should not have this problem. Just make sure everything visits MantisBT through the same URL, even the stuff on the same server as MantisBTprash315 wrote:The command line/task scheduling works perfectly fine. The issue is with the email that goes out to everyone. It contains an invalid link to the issue.
It was not recommended to use the webserver option. Whether that is locahost or the actual URL makes not difference for the adviseprash315 wrote:I tried the webserver path and that worked fine too. I was against option 2 because the documentation says not recommended. I also thought it might have security vulnerabilities, due to the fact that there is no authentication required as such. But, if I use mail_secured_ipaddr I guess we can get around that.
It was an issue in the past which should be fixed. If you still encounter it when using command line then its something that should be checked outprash315 wrote:I want to check if anybody else has reported the issue with issue links in the email when running from command line, or is it just me due to some incorrect configuration.
Please check the MantisBT configuration report and tell me what URL is shown for the Configuration Option 'plugin_EmailReporting_mail_mantisbt_url_fix'
Re: EmailReporting issue link URL
i dont see this variable 'plugin_EmailReporting_mail_mantisbt_url_fix' in the configuration page. Can I make one ?
Re: EmailReporting issue link URL
You could but it would not be automatically updated as it should. If you are in a hurry manually adding that variable should solve your issue
But i'd much rather find out the cause why it was not created and fix it
I've installed xampp and have reproduced the issue.
I'll let you know what i find
But i'd much rather find out the cause why it was not created and fix it
I've installed xampp and have reproduced the issue.
I'll let you know what i find
Last edited by SL-Gundam on 06 Sep 2017, 17:36, edited 2 times in total.
Re: EmailReporting issue link URL
This should do it
https://github.com/mantisbt-plugins/Ema ... e17fff3c01
Please download the latest version and let me know whether the fix also works for you
https://github.com/mantisbt-plugins/Ema ... e17fff3c01
Please download the latest version and let me know whether the fix also works for you
Re: EmailReporting issue link URL
I updated the line of code and looks like it has resolved the issue. I also see the variable plugin_EmailReporting_mail_mantisbt_url_fix in the configuration report page. Thank you for the quick turnaround.