Tuesday, May 27, 2008

Mantis Email Sending Problem

If when using the Mantis (bug tracking system), you get a message like:
"SYSTEM WARNING: fsockopen() [function.fsockopen]: unable to connect to smtpserver:25 (Permission denied)"
you may take a look at the Mantis forums.
If the answers given there did not solve your problem, then the information below may help you:

(I assume that you are using Linux :) )
In your terminal window, type
tail -f /var/log/messages
and press ENTER.
You may see something like:
"SELinux is preventing the httpd daemon from connecting to network port 25"

If this is the case, then, you may prevent the SELinux from running :) [But if your server is open to internet, stopping SELinux may not be a wonderful idea, I am NOT a SELinux expert]

To disable the SELinux, type
vi /etc/selinux/config
and press ENTER.
In vi editor (i hope you know how to use vi, you may use nano or other editor as well), change the
line as

Save and exit the config file.
Reboot your server.
You probably will not get smtp error from your Mantis.


Blai Monegal said...

I have the same problem but with mantis installed in windows. Any idea how to solve it?
Apparently yesterday was sending emails normally and today it's not.

Serdar Torun said...

I did not work with the Mantis installed on Windows, but there may be a firewall which prevents Man tis from sending e-mails.

Paul Willis said...

Thanks very much for this. I'd spent half a day messing about trying to get my email working from mantis.

BTW to just allow SELinux to still be enabled but mantis send emails this command (all on one line) will fix it...

/usr/sbin/setsebool -P httpd_can_network_connect=1