I posted about this problem on the Zimbra forums, and they suggested I post here. I haven't been able to figure this out for quite a while (since August, 2008, at least).

The problem I am having is that when my server boots up, both Zimbra and Drupal want to access postfix. It seems that Drupal usually wins, but that's no good, because then Zimbra doesn't work at all.

My solution thus far has been to kill the postfix instance that drupal starts, and then to restart Zimbra. This works, but then Drupal can't send mail, which is bad for numerous reasons.

Does anybody have any suggestions for methods so that the two apps can share postfix or each have their own instance, or something? I'd like to go virtual, but that's kind of a big solution to what seems like a pretty small problem.

Some other relevant details. The post on the Zimbra forum is here: http://www.zimbra.com/forums/installation/3688-mta-smtp-issues-after-ins...

The error Zimbra gives me when Drupal has postfix is: a non-zimbra postfix is already running:
disable that and run "chown zimbra:zimbra /var/log/zimbra.log" as root and you should be ready to go

Any help?

Comments

styro’s picture

Drupal just uses the built in mail sending function of PHP, and how that works is configured in php.ini. On Windows by default it will use an SMTP server running on localhost port 25, on unix it will use the sendmail command line utility.

see:
http://php.net/manual/en/mail.requirements.php
http://php.net/manual/en/mail.configuration.php
http://php.net/manual/en/book.mail.php

Postfix includes its own sendmail utility that is compatible with the user interface of the original Sendmail one. This sendmail utility will create a mail message and drop the it the appropriate postfix queue. If postfix isn't running, then the message will wait in the queue until postfix starts again.

Drupal doesn't directly use or configure any postfix daemons at all, it just relies on PHP being able to run the sendmail command provided by postfix. There is nothing Drupal related here, you would have the same issues with any other PHP app that used the PHP mail function.

Your choices would be:

a) configure PHP to use Zimbras postfix by changing the path to the sendmail utility. I guess that wouldn't cause any problems, but I don't know Zimbra. Then leave Ubuntus built-in postfix disabled.

Note: Try the above before worrying about this... You might still have problems with PHP finding the old sendmail utility on the PATH though. You'll either need to change the PATH that Apache/PHP uses, or you might be able to use the MAIL_CONFIG environment variable to tell Ubuntus sendmail to use Zimbras postfix configuration (see the sendmail man page).

or

b) reconfigure Ubuntus postfix so that nothing comflicts with Zimbras. eg change port numbers and/or IP addresses and/or unix pipe names etc until they can both run without bumping into each other. You'd really need help from the postfix community for that.

or

c) Leave Ubuntus postfix disabled, and install one of the SMTP modules for Drupal that directly use SMTP for outgoing mail. That way you could use Zimbra as the lcoal mail server for this.

Hope that helps

mlissner’s picture

This was a very helpful post. Figuring out that it's in fact php that needs to be reconfigured was a big step for some reason. The process I used to fix this was to turn off the usual postfix startup:
update-rc.d -f postfix remove

So now it theoretically won't start up when the server reboots.

Then, I had to reconfigure the php.ini file by:
sudo vi /etc/php5/apach2/php.ini

Then I edited it as follows:
637 [mail function]
638 ; For Win32 only.
639 SMTP = localhost
640 smtp_port = 25
641
642 ; For Win32 only.
643 ;sendmail_from = me@example.com
644
645 ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
646 sendmail_path = /opt/zimbra/postfix/sbin/sendmail -t
647
648 ; Force the addition of the specified parameters to be passed as extra parameters
649 ; to the sendmail binary. These parameters will always replace the value of
650 ; the 5th parameter to mail(), even in safe mode.
651 ;mail.force_extra_parameters =

After that, I restarted apache, and things worked. I also did the update-alternatives command listed here: http://wiki.zimbra.com/index.php?title=How_to_%22fix%22_system%27s_sendm...

But I'm unsure that that did anything. So, in the end, I did option c, which isn't exactly my preference because I'm going to have mail problems again later if I want to use the system mailer, but we'll cross that bridge then!

liquidcable’s picture

This solution worked for me. I'm running Zimbra and Ubuntu 8.04.

buee’s picture

What OS did you do this on, mlissner? I'm running drupal on Ubuntu and desperately need the ability to send e-mail. I already have a Zimbra server set up and am solely administering it, but I fear its authentication may be a bit difficult to overcome.

mlissner’s picture

For some reason, the drupal.org site doesn't ping me when people reply to threads on the forum.

Anyway, I was running this on Ubuntu 7.04...until today. I just updated to 8.04, since that's what Zimbra recommends. I'm running into new problems today. I'll post if I figure out the solution, and if it's anything interesting.