Page 1 of 1

Tweaking Notification Emails

Posted: 27 May 2014, 19:07
by Draco18s
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.

Re: Tweaking Notification Emails

Posted: 27 May 2014, 22:57
by paul
try overriding $t_hostname in email_store in email_api.php

Re: Tweaking Notification Emails

Posted: 28 May 2014, 05:46
by atrol
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 like

Code: Select all

http://yourDomainOrIP/mantis/
should do the job

Re: Tweaking Notification Emails

Posted: 28 May 2014, 14:44
by Draco18s
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.

Re: Tweaking Notification Emails

Posted: 29 May 2014, 15:24
by Draco18s
Found what I needed.

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 );
}
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.