I'm running Mantis on a server that does not have a domain name associated with it, just an IP address. This is fine for what I'm doing, but there's a slight problem:
The IP address that is used in the notification emails is the local IP address the server has on the LAN. Anyone not in the office won't be able to use the link.
I'm not a whiz at PHP, but I can stumble my way through it (mostly due to the syntax). But I need to know where to go in order to insert the external IP of the server rather than the internal IP.
If someone could point me to the right file, that's be great.
Tweaking Notification Emails
Moderators: Developer, Contributor
Re: Tweaking Notification Emails
try overriding $t_hostname in email_store in email_api.php
Would you be interested in testing support for non-mysql backends for MantisBT? if yes, please email paul@mantisforge.org
Re: Tweaking Notification Emails
Paul, this is no solution for what Draco18s is asking for (link in email is not working)
Changing t_hostname does not affect the link but the email metadata.
I didn't try, but changing $g_path in config_inc.php to something likeshould do the job
Changing t_hostname does not affect the link but the email metadata.
I didn't try, but changing $g_path in config_inc.php to something like
Code: Select all
http://yourDomainOrIP/mantis/
Re: Tweaking Notification Emails
Ok, that's the thing, I don't have a domain name. 'www.namehere.com' won't work.
I don't mind using the external IP address, just means that those of us here in the office won't actually be able to use the links (which is better than everyone not in the office having that problem).
But what I was really hoping to be able to do is have both.
It also appears that I somehow broke Mantis changing the config_inc.php. Mantis now throws "The server at 1.246.15.214 is taking too long to respond." And that's not the IP the server is on, internal or external. And that's after I reverted my changes.
Nevermind. Not sure how the url in my address bar changed, that was weird.
Edit 2:
Ok, changing the path causes Mantis to try and load its images/css via that path (absolute rather than relative), which won't work, as from the internal network the external IP loads the router.
I don't mind using the external IP address, just means that those of us here in the office won't actually be able to use the links (which is better than everyone not in the office having that problem).
But what I was really hoping to be able to do is have both.
It also appears that I somehow broke Mantis changing the config_inc.php. Mantis now throws "The server at 1.246.15.214 is taking too long to respond." And that's not the IP the server is on, internal or external. And that's after I reverted my changes.
Nevermind. Not sure how the url in my address bar changed, that was weird.
Edit 2:
Ok, changing the path causes Mantis to try and load its images/css via that path (absolute rather than relative), which won't work, as from the internal network the external IP loads the router.
Re: Tweaking Notification Emails
Found what I needed.
In string_api.php I had to change:
And replace the path part with a custom string.
I was also able to use Fancy String Magic on an aspx page on our normal webserver to take the fragment URL after the .aspx? and convert it into a fragment on the end of the iframe URL.
I.e. the link that shows up in the email is:
http://www.oursite.com/bugs.aspx?view.php?id=3
Which then turns that into
http://[the_correct_IP_address]/mantis/view.php?id=3
And loads that URL in an iframe.
In string_api.php I had to change:
Code: Select all
function string_get_bug_view_url_with_fqdn( $p_bug_id, $p_user_id = null ) {
return config_get( 'path' ) . string_get_bug_view_url( $p_bug_id, $p_user_id );
}
I was also able to use Fancy String Magic on an aspx page on our normal webserver to take the fragment URL after the .aspx? and convert it into a fragment on the end of the iframe URL.
I.e. the link that shows up in the email is:
http://www.oursite.com/bugs.aspx?view.php?id=3
Which then turns that into
http://[the_correct_IP_address]/mantis/view.php?id=3
And loads that URL in an iframe.