8 Modify /etc/aliases
Now we should open /etc/aliases. Make sure that postmaster points to root and root to your own username or your email address, e.g. like this:
vi /etc/aliases
[...]
postmaster: root
root: root@yourdomain.tld
[...]
|
Whenever you modify /etc/aliases, you must run
newaliases
afterwards and restart Postfix:
/etc/init.d/postfix restart
9 Quota Exceedance Notifications
If you want to get notifications about all the email accounts that are over quota, then do this:
cd /usr/local/sbin/
wget http://puuhis.net/vhcs/quota.txt
mv quota.txt quota_notify
chmod 755 quota_notify
Open /usr/local/sbin/quota_notify and edit the variables at the top. Further down in the file (towards the end) there are two lines where you should add a % sign:
vi /usr/local/sbin/quota_notify
[...]
my $POSTFIX_CF = "/etc/postfix/main.cf";
my $MAILPROG = "/usr/sbin/sendmail -t";
my $WARNPERCENT = 80;
my @POSTMASTERS = ('postmaster@yourdomain.tld');
my $CONAME = 'My Company';
my $COADDR = 'postmaster@yourdomain.tld';
my $SUADDR = 'postmaster@yourdomain.tld';
my $MAIL_REPORT = 1;
my $MAIL_WARNING = 1;
[...]
print "Subject: WARNING: Your mailbox is $lusers{$luser}% full.\n";
[...]
print "Your mailbox: $luser is $lusers{$luser}% full.\n\n";
[...]
|
Run
crontab -e
to create a cron job for that script:
0 0 * * * /usr/local/sbin/quota_notify &> /dev/null
|
10 Test Postfix
To see if Postfix is ready for SMTP-AUTH and TLS, run
telnet localhost 25
After you have established the connection to your Postfix mail server type
ehlo localhost
If you see the lines
250-STARTTLS
and
250-AUTH PLAIN LOGIN
everything is fine:
root@server1:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@server1:~#
Type
quit
to return to the system shell.
11 Install Roundcube Mail
Create a new VirtualHost in Apache2 for webmail access. Make sure you change any
instance of mail.domain.com to your own domain.
vi /etc/apache2/sites-available/mail.example.com
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName mail.example.com
DocumentRoot /var/mail.example.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/mail.example.com/>
Options FollowSymLinks
AllowOverride AuthConfig
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
ErrorLog /var/log/apache2/mail.error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/mail.access.log combined
ServerSignature On
</VirtualHost>
|
Make the directory for the document root of the new site:
mkdir /var/mail.domain.com
Then symlink that to the sites-enabled directory and restart Apache2:
cd /etc/apache2/sites-enabled
ln –s ../sites-available/mail.domain.com 001-mail.domain.com
/etc/init.d/apache2 restart
Download and unpack Roundcube:
wget http://easynews.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1-rc2.tar.gz
tar zxvf roundcubemail-0.1-rc2.tar.gz
cd roundcubemail-0.1-rc2
cp –r * ../
cd ..
rm –rf roundcubemail-0.1-rc2*
Now we must configure Roundcube to attach to our servers:
cd config/
cp db.inc.php.dist db.inc.php
vi db.inc.php
Line 21 will need to be modified as follows:
$rcmail_config['db_dsnw'] = 'mysql://mail_admin:mail_admin_password@localhost/roundcubemail';
|
Then modify the main.inc.php file:
cp main.inc.php.dist main.inc.php
vi main.inc.php
Line 38:
$rcmail_config['default_host'] = 'localhost';
|
Line 63:
$rcmail_config['smtp_server'] = 'localhost';
|
Line 70:
$rcmail_config['smtp_user'] = '%u';
// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';
|
Now we need to make a DB and grant privileges to Roundcube to access the DB:
mysql –u root –p
create database roundcubemail;
grant all privileges on roundcubemail.* to mail_admin@localhost identified by 'mail_admin_password';
quit;
Now populate the db:
mysql –u mail_admin -p roundcubemail < /var/mail.example.com/SQL/mysql.initial.sql
Roundcube should now be setup and accessible at http://mail.example.com
NOTE: Keep in mind you can’t log in as a user until mail is sent to that user.
To do this manually connect to the mail server and send a piece of mail:
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix (Ubuntu)
ehlo me
250-mail.domain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: root@domain.com
250 2.1.0 Ok
rcpt to: root@domain.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: Testing
test
.
250 2.0.0 Ok: queued as 6B4022D82B5
quit
221 2.0.0 Bye
Connection closed by foreign host.
Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.06 LTS) - Page 2
Recent comments
13 hours 37 min ago
17 hours 20 min ago
17 hours 30 min ago
17 hours 37 min ago
19 hours 21 min ago
23 hours 19 min ago
1 day 10 hours ago
2 days 20 hours ago
3 days 6 min ago
3 days 47 min ago