Tweaking Notification Emails

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Draco18s
Posts: 5
Joined: May 27, 2014 1:59 pm

Tweaking Notification Emails

Post 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.

paul
Posts: 43
Joined: Mar 11, 2005 6:18 am

Re: Tweaking Notification Emails

Post by paul »

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

atrol
Site Admin
Posts: 7788
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Tweaking Notification Emails

Post 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
Please use Search before posting and read the Manual

Draco18s
Posts: 5
Joined: May 27, 2014 1:59 pm

Re: Tweaking Notification Emails

Post 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.

Draco18s
Posts: 5
Joined: May 27, 2014 1:59 pm

Re: Tweaking Notification Emails

Post 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.

Post Reply