Summary
Using the PHP's mail() command with Kerio MailServer requires (a) creating a symbolic link, (b) changing the php.ini file, (c) setting the permissions on the SendMail binary, (d) disabling Postfix, and (e) configuring the Relay Control settings.
Creating the symbolic link
- Using Terminal, navigate to the directory /usr/sbin using this command: cd /usr/sbin
- Disable OS X's Sendmail binary using this command: sudo mv ./sendmail ./sendmail-orig
- Create the symlink using this command: ln -s /usr/local/kerio/mailserver/sendmail
Changing the php.ini file
- Using Terminal, navigate to the directory /etc using this command: cd /etc
- Rename php.ini.default to php.ini using this command: sudo mv php.ini.default php.ini
- Edit the php.ini file with the VI editor using this command: vi php.ini
- Type the command /sendmail to quickly find the sendmail section of the php.ini file.
Navigation tips
Use the letter j or k to move up or down in the VI editor.
Use the letter h or l to move to the left or the right in the VI editor
- Use the letter x to remove the semi-colon in front of sendmail_path
- Click on the letter I to enter Insert mode.
- Change sendmail_path to look like this: sendmail_path = /usr/local/kerio/mailserver/sendmail -i -t
- Click on the ESC key to exit Insert mode.
- Use this command save the changes :w!
- Use this command to exit the VI editor :q
Setting the permissions on the SendMail binary
- Using Terminal, navigate to the directory /usr/local/kerio/mailserver using this command: sudo cd /usr/local/kerio/mailserver
- Run this command to change the permissions on the SendMail binary: sudo chmod 755 sendmail
- Verify the permissions are correct using the command: ls -l sendmail
We are expecting this result: -rwxr-xr-x@ 1 root wheel 4252344 Dec 11 18:38 sendmail
As of version 7.2.0 of Kerio Connect you will also need to make the following changes.
- Using Terminal, navigate to the directory /usr/local/kerio/mailserver using this command: sudo cd /usr/local/kerio/mailserver
- Run this command to change the permissions on the first file, sudo chmod 755 ktcrypto.0.9.8.dylib
- Run this command to change the permissions on the second file, sudo chmod 755 ktssl.0.9.8.dylib
- Verify the permissions are correct using the command: ls -l kt*
- Run this command to change the permissions of the mailserver directory, so the PHP can access the sendmail file located in this directory, sudo chmod 755 /usr/local/kerio/mailserver
The result should be: -rwxr-xr-x 1 root wheel 3395124 Jul 18 15:44 ktcrypto.0.9.8.dylib
-rwxr-xr-x 1 root wheel 740656 Jul 18 15:44 ktssl.0.9.8.dylib
Please note that the permissions on these files are reset after upgrading Kerio Connect.
Disabling Postfix (for OSX 10.4-10.6)
Using Terminal, type this command: sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist
That single command should stop Postfix from trying to start on port 25.
Configuring the Relay Control settings
- While logged into the Kerio MailServer Admin Console, go to Configuration → SMTP Server → Relay Control.
- Enable "Users from IP address group" and click on the Edit button.
- Click Add
- Name the Address Group Localhost
- Select Host and type 127.0.0.1 in the IP address field.
- Click OK
- Click Apply and Close
- Select the IP address group named Localhost
- Click Apply
You should now be able to use PHP's mail() command with Kerio MailServer
The webserver application must run as root when executing the PHP script.
|