Page 1 of 1

PHPMailer with Exchange

Posted: 19 Sep 2007, 14:16
by Ian W
I've just setup Mantis on my Apache server, im trying to get the phpmailer function working with my exchange server but im not getting any good results, i've got the following lines in my config_inc.php file;
$g_administrator_email = 'myemail@myserver.co.uk;
$g_webmaster_email = 'admin@myserver.co..uk'; # the "From: " field in emails
$g_from_email = 'noreply@myserver.co.uk'; # the return address for bounced mail
$g_return_path_email = 'myemail@myserver.co.uk';
$g_enable_email_notification = On;
$g_validate_email = On;
$g_enable_email_notification = On;
$g_allow_signup = Off;
$g_send_reset_password = Off;
$g_phpMailer_method = 2;

$g_smtp_host = 'myserver.mydomain.local';
$g_smtp_username = 'my domain username';
$g_smtp_password = 'my domain password';
I've got my SMTP server defined in php.ini.

Is this right or have I got something wrong on the config? I'm not getting any error messages at all, im just getting a "SENDING FAILED" message, bit hard to troubleshoot !

Anyone got any tips?

Posted: 20 Sep 2007, 13:11
by Narcissus
This may be a silly question, but are you sure that your Exchange server is set up to accept SMTP requests and/or to be used as a gateway (or whatever it's called... sorry, bad coffee day)?

Posted: 20 Sep 2007, 13:52
by Ian W
I think you may be right, I am now getting the following error
SYSTEM WARNING: fsockopen() [function.fsockopen]: unable to connect to myserver:25 (No connection could be made because the target machine actively refused it.)
Going to check the settings of my Exchange Server and try again :?

Posted: 20 Sep 2007, 15:14
by Ian W
I've checked my Exchange, seems to be ok and should work.

From the machine that is running Mantis I can telnet to the Exhange server on port 25 and get a reply.

Can't see why the PHPMailer script is being rejected though ?

Posted: 24 Sep 2007, 02:34
by Narcissus
OK, so now I'm clutching at straws :)

I wonder if it's a user thing? Maybe if you are logged into the network the Exchange server is giving YOU access but when the web server is trying to access it (Apache, IIS or something else, by the way?) then the user running the server is not given access?

Again, just clutching at straws but I figured that I may as well suggest it.

Posted: 24 Sep 2007, 11:54
by Ian W
I've got it working (kind of)

I can get Mantis to send mails now but once I include the line

$g_enable_email_notification = on;

in my config_inc.php then it stops working :(

Have you ever seen that happen before?

Posted: 24 Sep 2007, 12:00
by Narcissus
"then it stops working"

What is "it", exactly? Mantis entirely or just the sending of emails?

For what it's worth, that should be:
$g_enable_email_notification = ON;

anyway, as it's case-sensitive.

Posted: 24 Sep 2007, 13:15
by Ian W
I meant the email stops working.

Thanks for tip about it being case sensitive, I changed that and its all working now :D

Thanks