Drupal + Postfix Integration Under Ubuntu 8.04 (Hardy) - Page 4

Drupal Installation and Configuration

We will download and install Drupal 6.x. Then we will download and install Mailfix module (http://drupal.org/project/mailfix) which as of this writing is only available for Drupal version 6.x.

Drupal files will be unpacked in /var/www/example.com.

cd /var/www
wget http://ftp.drupal.org/files/projects/drupal-6.x.tar.gz

As of this writing, current version is 6.4, thus the target file would be drupal-6.4.tar.gz. Just keep in mind that you must replace the 6.x part with the appropriate Drupal version. 

tar -xvzf drupal-6.x.tar.gz
mv drupal-6.x example.com
cd example.com
mkdir -p sites/all/modules
cd sites/all/modules
wget http://ftp.drupal.org/files/projects/mailfix-6.x-1.1.tar.gz

tar -xvzf mailfix-6.x-1.1.tar.gz
cd /var/www
chown -R www-data.www-data example.com

Now we need to create the Drupal database, which will be named as drupal_example_com in our tutorial and will be accessible with full privileges by user drupal_example_com@localhost:

mysql -p
mysql> create database drupal_example_com;

Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on drupal_example_com.* to drupal_example_com @localhost identified by 'secret' with grant option;

Query OK, 0 rows affected (0.00 sec)

mysql> quit

Web interface configuration can proceed by accessing http://www.example.com directly. Follow the instructions on screen to setup your Drupal site.

The next task to accomplish is to create your first Drupal account, which will be granted total administrative privileges. Remember we asked you to write down your Drupal credentials before? Well, this is where you're expected to apply them.

Then we configure cron entry for Drupal self-maintenance:

crontab -e

# Example Drupal site cron
49 * * * * /usr/bin/wget -O - -q http://www.example.com/cron.php &> /dev/null

The &> /dev/null part is intended to reduce mail alerts issued by crontab.

Now we configure uploaded files directory. This is also a matter of personal taste. We prefer those files to be transferred by Drupal, so they must reside outside the /var/www/example.com directory. We create /var/drupal_files directory for this purpose and make it writable by Apache daemon:

cd /var
mkdir -p drupal_files/example.com
chown -R www-data.www-data drupal_files/

Inside Drupal we configure the File System with this structure in mind:

  • File System Path: /var/drupal_files/example.com
  • Download Method: Private

You may proceed to install and configure the Mailfix module:

  • Go to Administer ? Site building ? Modules
  • Enable the Mailfix module

From here you may add all mail domains your Drupal system is intended to control:

  • Go to Administer ? Site Configuration ? Mailfix domains
  • Then go to Add domains

The Mailfix documentation is self-explanatory.

Share this page:

6 Comment(s)

Add comment


From: MarkFoodyBurton at: 2009-01-21 12:17:13

Not sure the quota stuff will work

1. the postfix config param seems to be virtual_mailbox_limit, not virtual_mailbox_limit_map as mentioned here.

2. I suspect  that since Dovecot is being used for delivery, the number will be ignored anyway?

 Hope I'm wrong :-)






From: vivek at: 2011-06-02 10:26:13

In the mysql query from where does the place holder is getting the values. I am new to this world please help

From: Paul H at: 2008-10-28 18:25:36

It appears that dovecot expects a returned field called 'password' whilst the mysql and drupal returns a field called 'pass' which means that authentications via pop3 and imap don't work.

Any thoughts?


From: Nik Sulaiman at: 2008-11-18 03:11:04

in /etc/dovecot/dovecot-sql.conf

add the underlined text:

password_query = SELECT mail AS user, pass AS password FROM users WHERE mail='%u';

I was having the problem too, thanks for the post.

Managed to authenticate via imap successfully. Hope it helps.

From: at: 2009-03-06 21:29:14

Nik Sulaiman,

 Thank you for your fix. It has been updated in the tutorial.

 Alex Saavedra

From: plen at: 2011-01-29 07:57:53

The mail_plugins line in the dovecot.conf should be set to just "sieve" not "cmusieve"