Email setup with Exchange

Tagged:  

We are trying to setup the email function in ProjectPier. When I try to send a test email out I just get a error message: Notifier has failed to construct mailer object

Session "default" started at 2012-01-26T20:35:15+0000
#1 ERROR: Error: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in 'D:\ProjectPier\library\swift\lib\Swift\Stream\MailProxy.php' on line 391 (error code: 2)

Can someone please advise how to get this working.

This is self-hosted and the email were using is internal on our own exchange server.

I guess the Exhange server is not running on your machine? Because the errors says "localhost" port 25. Get the details from the Exchange server (ip address + port or dns name + port) and enter them the configuration.

Under Configuration / Mailing select SMTP server instead of default after Mail transport: and fill out the SMTP server and port. Try again. If authentication is needed, set Use authentication to Yes and fill out SMTP Username and SMTP Password. Most probably you also need to check the Exchange option at the bottom.

It is a bit of fiddling to get it going and it all depends on the configuration of Exchange in your shop.

We have the suggested configuration in place. However, when using the SMTP setting, no entries are noted in the log file to allow us to trace the exact error that is occurring. All that we get is the “Notifier has failed to construct mailer object” error when utilizing the Test Mail Settings tool.

If that is the case then why do you have 'localhost' in the error message?
When that error occurs, it is my experience that the connection failed. There is nothing in cache/log.php?
Let me see what changes can be made to get you more information for debugging.

1) Does your PHP allow socket functions? See phpinfo.php for that.
2) More logging: edit application/models/notifier/Notifier.class.php
Change code around line 632
from

        if (!$mailer->isConnected()) {
          return null;
        } // if

to:

        if (!$mailer->isConnected()) {
          Logger::log("Swift_Connection_SMTP($smtp_server, $smtp_port, $transport) failed", Logger::FATAL);
          return null;
        } // if

Made the requested change. Then received the below error:

Session "default" started at 2012-01-27T17:44:31+0000
#1 ERROR: Error: Assigning the return value of new by reference is deprecated in 'D:\ProjectPier\application\plugins\reports\library\jpgraph\src\jpgraph_plotmark.inc' on line 62 (error code: 8192)
Time since start: 0.42580604553223 seconds

Was fixed by removing the amperstand from this line per PHP 5.3 specs.

$_gFlagCache[$aSize] =& new FlagImages($aSize);

However we are now back to not having an error recorded in the log even though we are still receiving the “Notifier has failed to construct mailer object” error.

Bump up

Can we do this in an interactive session? Maybe via Skype? I really want to solve this.

Please unzip the attached file and put the unzipped file in /application/models/notifier. There are a lot of trace statements added. Run the application with trace on now. Then check cache/trace.txt what happened to getMailer.

AttachmentSize
notifier.zip 4.02 KB