Creating a Mail Server on Ubuntu (Postfix, Courier, SSL_TLS, SpamAssassin, ClamAV, Amavis) «...
description
Transcript of Creating a Mail Server on Ubuntu (Postfix, Courier, SSL_TLS, SpamAssassin, ClamAV, Amavis) «...
-
type your search here
BRAIN SPLURGE FROM WEB PEOPLE
GENERAL DESIGN SYSTEM ADMINISTRATION
System Administration
Creating a Mail Server on Ubuntu (Postfix, Courier,SSL/TLS, SpamAssassin, ClamAV, Amavis)
An article by Adam 160 Comments
UPDATE: This guide has been updated to work with Ubuntu 12.04 LTS.
Note: this has been tested to work on the following versions of Ubuntu:
Ubuntu 12.04
Ubuntu 11.04
Ubuntu 10.04
Ubuntu 9.04
One of the most fragile and fragmented services Ive had to configure on Ubuntu is a mail server.
No matter which of the many guides I follow, each time I do it theres always something not
working.
This one is mostly for my benefit, but hopefully itll be useful to others, too. Ive tried to make
the guide easy to follow and as short as possible. Please comment if something isnt clear.
Before we start, I have to give a huge amount of credit to Ivar Abrahamsen for his guide which is,
by far, one of the best ones out there.
So lets kick off
Well be building a mail server made up of the following components:
Postfix is the mail transfer agent (MTA) responsible for accepting new messages and storing
them on your server as well as allowing authorised users to send e-mail.
Courier sits in front of Postfix and provides an IMAP and POP3 interface for clients to connect
to.
SASL with SSL and TLS allows you to authenticate and communicate with the mail server
securely.
SpamAssassin will analyse your e-mails as they arrive and will filter out what it thinks is
spam.
ClamAV will scan e-mails for viruses before delivering it to your inbox.
Amavis ties SpamAssasin and ClamAV together, and is itself hooked into Postfix.
MySQL will be used to manage user accounts and e-mail forwarding.
Installation
First, switch to the root user unless, of course, you like typing sudo.
sudo su -
For simplicity, well install all the software in one go:
apt-get updateapt-get install -y mysql-server postfix postfix-mysql libsasl2-modules libsasl2-modules-sql libg
Oct
28282010
SPONSERS
Nexus One Android 2.3.3 (Gingerbread)
OTA Download Link
Flickering Monitor (Samsung, maybe
others too)
Placing files with Photoshop and
Illustrator
Creating a Mail Server on Ubuntu
(Postfix, Courier, SSL/TLS,
SpamAssassin, ClamAV, Amavis)
Nexus One Slow 3D Gallery on Android
Froyo (2.2) [Solved]
RECENT POSTS
February 2011
January 2011
November 2010
October 2010
ARCHIVES
DEVELOPMENT
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
1 din 44 10/04/2013 14:49
-
During the installation of MySQL you will be prompted for the root user password, as shown:
Enter a secure password, and dont forget it!
Similarly, during the installation of Courier you will be presented with the following configuration
prompts:
Choose No
SPONSERS
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
2 din 44 10/04/2013 14:49
-
Choose OK
Choose Internet Site
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
3 din 44 10/04/2013 14:49
-
Enter your mail server name (e.g. replace example.com with your own domain). Make sure you
have this subdomain configured in your DNS records.
Choose OK
I wont walk you through the parameters were using when configuring Postfix as I want to keep
this guide light. If youre interested, you can find more information from the man pages.
mv /etc/postfix/main.cf{,.default}vi /etc/postfix/main.cf
Copy/paste the following (change all instances of mail.example.com):
myorigin = /etc/mailnamesmtpd_banner = $myhostname ESMTP $mail_namebiff = noappend_dot_mydomain = noreadme_directory = nomydestination =relayhost =mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128mynetworks_style = hostmailbox_size_limit = 0virtual_mailbox_limit = 0recipient_delimiter = +inet_interfaces = allmessage_size_limit = 0
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
4 din 44 10/04/2013 14:49
-
# SMTP Authentication (SASL)
smtpd_sasl_auth_enable = yesbroken_sasl_auth_clients = yessmtpd_sasl_security_options = noanonymoussmtpd_sasl_local_domain =
# Encrypted transfer (SSL/TLS)
smtp_use_tls = yessmtpd_use_tls = yessmtpd_tls_cert_file = /etc/ssl/private/mail.example.com.crtsmtpd_tls_key_file = /etc/ssl/private/mail.example.com.keysmtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scachesmtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# Basic SPAM prevention
smtpd_helo_required = yessmtpd_delay_reject = yesdisable_vrfy_command = yessmtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, rejectsmtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject
# Force incoming mail to go through Amavis
content_filter = amavis:[127.0.0.1]:10024receive_override_options = no_address_mappings
# Virtual user mappings
alias_maps = hash:/etc/aliasesalias_database = hash:/etc/aliasesvirtual_mailbox_base = /var/spool/mail/virtualvirtual_mailbox_maps = mysql:/etc/postfix/maps/user.cfvirtual_uid_maps = static:5000virtual_gid_maps = static:5000virtual_alias_maps = mysql:/etc/postfix/maps/alias.cfvirtual_mailbox_domains = mysql:/etc/postfix/maps/domain.cf
mv /etc/postfix/master.cf{,.default}vi /etc/postfix/master.cf
Copy/paste the following (no changes required):
### Postfix master process configuration file. For details on the format# of the file, see the master(5) manual page (command: "man 5 master").## Do not forget to execute "postfix reload" after editing this file.## ==========================================================================# service type private unpriv chroot wakeup maxproc command + args# (yes) (yes) (yes) (never) (100)# ==========================================================================smtp inet n - - - - smtpdsmtps inet n - - - - smtpd -o smtpd_tls_wrappermode=yessubmission inet n - - - - smtpdpickup fifo n - - 60 1 pickup -o content_filter= -o receive_override_options=no_header_body_checkscleanup unix n - - - 0 cleanupqmgr fifo n - n 300 1 qmgrtlsmgr unix - - - 1000? 1 tlsmgrrewrite unix - - - - - trivial-rewritebounce unix - - - - 0 bouncedefer unix - - - - 0 bouncetrace unix - - - - 0 bounceverify unix - - - - 1 verifyflush unix n - - 1000? 0 flushproxymap unix - - n - - proxymapproxywrite unix - - n - 1 proxymapsmtp unix - - - - - smtp# When relaying mail as backup MX, disable fallback_relay to avoid MX loopsrelay unix - - - - - smtp
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
5 din 44 10/04/2013 14:49
-
-o smtp_fallback_relay=showq unix n - - - - showqerror unix - - - - - errorretry unix - - - - - errordiscard unix - - - - - discardlocal unix - n n - - localvirtual unix - n n - - virtuallmtp unix - - - - - lmtpanvil unix - - - - 1 anvilscache unix - - - - 1 scache## ====================================================================# Interfaces to non-Postfix software. Be sure to examine the manual# pages of the non-Postfix software to find out what options it wants.## Many of the following services use the Postfix pipe(8) delivery# agent. See the pipe(8) man page for information about ${recipient}# and other message envelope options.# ====================================================================## maildrop. See the Postfix MAILDROP_README file for details.# Also specify in main.cf: maildrop_destination_recipient_limit=1#maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}## See the Postfix UUCP_README file for configuration details.#uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)## Other external delivery methods.#ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipientscalemail-backend unix - n n - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${usemailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}amavis unix - - - - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes -o max_use=20127.0.0.1:10025 inet n - - - - smtpd -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= -o smtpd_restriction_classes= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
As all our mail users are going to be virtual (i.e. were not going to create physical user accounts
for each user), we only need to create one mail directory and one user account.
groupadd virtual -g 5000useradd -r -g "virtual" -G "users" -c "Virtual User" -u 5000 virtualmkdir /var/spool/mail/virtualchown virtual:virtual /var/spool/mail/virtual
Make sure that, if the UID or GID differs from 5000, you update the virtual_uid_maps and
virtual_gid_maps values in /etc/postfix/main.cf, and MYSQL_UID_FIELD and
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
6 din 44 10/04/2013 14:49
-
MYSQL_GID_FIELD in /etc/courier/authmysqlrc (later in this guide).
Now well create the database which will store the mail user configuration and forwarding rules.
mysql -uroot -p
Enter the password you created during the MySQL installation.
Copy/paste the following (change mailuserpassword, example.com and change the admins
password to something more secure):
CREATE DATABASE mail;GRANT ALL ON mail.* TO mail@localhost IDENTIFIED BY 'mailuserpassword';
FLUSH PRIVILEGES;USE mail;
CREATE TABLE IF NOT EXISTS `alias` ( `source` varchar(255) NOT NULL, `destination` varchar(255) NOT NULL default '', `enabled` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`source`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `domain` ( `domain` varchar(255) NOT NULL default '', `transport` varchar(255) NOT NULL default 'virtual:', `enabled` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`domain`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `user` ( `email` varchar(255) NOT NULL default '', `password` varchar(255) NOT NULL default '', `name` varchar(255) default '', `quota` varchar(255) default NULL, `enabled` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`email`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `alias` (`source`, `destination`, `enabled`) VALUES ('@localhost', '[email protected] INTO `alias` (`source`, `destination`, `enabled`) VALUES ('@localhost.localdomain'INSERT INTO `domain` (`domain`, `transport`, `enabled`) VALUES ('localhost', 'virtual:'INSERT INTO `domain` (`domain`, `transport`, `enabled`) VALUES ('localhost.localdomain'INSERT INTO `domain` (`domain`, `transport`, `enabled`) VALUES ('example.com', 'virtual:'INSERT INTO `user` (`email`, `password`, `name`, `quota`, `enabled`) VALUES ('[email protected]'
Note that were encrypting the password. Some guides will recommend storing the password in
clear text so that you can configure Postfix to support CRAM-* (e.g. CRAM-MD5) authentication
methods. I think its much more secure to store these passwords encrypted and use SSL/TLS to
encrypt your authentication requests. For that reason, we dont need to store clear text
passwords and we dont need to provide CRAM-* support.
Now that the database is in place we can create the map files to tell Postfix how to communicate
with it.
mkdir /etc/postfix/mapsvi /etc/postfix/maps/alias.cf
Copy/paste the following (change mailuserpassword):
user=mailpassword=mailuserpassworddbname=mailtable=aliasselect_field=destinationwhere_field=sourcehosts=127.0.0.1additional_conditions=and enabled = 1
vi /etc/postfix/maps/domain.cf
Copy/paste the following (change mailuserpassword):
user = mailpassword = mailuserpassworddbname = mail
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
7 din 44 10/04/2013 14:49
-
table = domainselect_field = domainwhere_field = domainhosts = 127.0.0.1additional_conditions = and enabled = 1
vi /etc/postfix/maps/user.cf
Copy/paste the following (change mailuserpassword):
user = mailpassword = mailuserpassworddbname = mailtable = userselect_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),where_field = emailhosts = 127.0.0.1additional_conditions = and enabled = 1
Set restrictive read permissions as these files contain the MySQL mail users password.
chmod 700 /etc/postfix/maps/*chown postfix:postfix /etc/postfix/maps/*
The final part of configuring Postfix is to configure the authentication mechanism. SASL is a
authentication layer that provides the ability to receive a users credentials in a variety of
formats.
mkdir -p /var/spool/postfix/var/run/saslauthdmkdir /etc/postfix/sasladduser postfix saslvi /etc/postfix/sasl/smtpd.conf
Copy/paste the following (change mailuserpassword):
pwcheck_method: saslauthdauxprop_plugin: sqlmech_list: plain loginsql_engine: mysqlsql_hostnames: 127.0.0.1sql_user: mailsql_passwd: mailuserpasswordsql_database: mailsql_select: SELECT password FROM user WHERE email='%u@%r' AND enabled = 1
chmod -R 700 /etc/postfix/sasl/smtpd.confmv /etc/default/saslauthd{,.default}vi /etc/default/saslauthd
Copy/paste the following (no changes required):
START=yesDESC="SASL Authentication Daemon"NAME="saslauthd"MECHANISMS="pam"MECH_OPTIONS=""THREADS=5OPTIONS="-r -c -m /var/spool/postfix/var/run/saslauthd"
vi /etc/pam.d/smtp
Copy/paste the following (change all instances of mailuserpassword):
auth required pam_mysql.so user=mail passwd=mailuserpassword host=127.0.0.1 db=maccount sufficient pam_mysql.so user=mail passwd=mailuserpassword host=127.0.0.1 db=m
chmod 700 /etc/pam.d/smtp
Now lets configure Courier.
I like to provide both IMAP and POP3 support, although personally I only use IMAP. In addition,
well be provide SSL support for securing authentication requests.
mv /etc/courier/authdaemonrc{,.default}vi /etc/courier/authdaemonrc
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
8 din 44 10/04/2013 14:49
-
Copy/paste the following (no changes required):
authmodulelist="authmysql"authmodulelistorig="authuserdb authpam authpgsql authldap authmysql authcustom authpidaemons=5authdaemonvar=/var/run/courier/authdaemonDEBUG_LOGIN=0DEFAULTOPTIONS=""LOGGEROPTS=""
mv /etc/courier/authmysqlrc{,.default}vi /etc/courier/authmysqlrc
Copy/paste the following (change mailuserpassword):
MYSQL_SERVER localhostMYSQL_USERNAME mailMYSQL_PASSWORD mailuserpasswordMYSQL_PORT 0MYSQL_DATABASE mailMYSQL_USER_TABLE userMYSQL_CRYPT_PWFIELD passwordMYSQL_UID_FIELD 5000MYSQL_GID_FIELD 5000MYSQL_LOGIN_FIELD emailMYSQL_HOME_FIELD "/var/spool/mail/virtual"MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@MYSQL_NAME_FIELD nameMYSQL_QUOTA_FIELD quota
mv /etc/courier/imapd{,.default}vi /etc/courier/imapd
Copy/paste the following (no changes required):
ADDRESS=0PORT=143MAXDAEMONS=40MAXPERIP=20PIDFILE=/var/run/courier/imapd.pidTCPDOPTS="-nodnslookup -noidentlookup"LOGGEROPTS="-name=imapd"IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REIMAP_KEYWORDS=1IMAP_ACL=1IMAP_CAPABILITY_ORIG="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREIMAP_PROXY=0IMAP_PROXY_FOREIGN=0IMAP_IDLE_TIMEOUT=60IMAP_MAILBOX_SANITY_CHECK=1IMAP_CAPABILITY_TLS="$IMAP_CAPABILITY AUTH=PLAIN"IMAP_CAPABILITY_TLS_ORIG="$IMAP_CAPABILITY_ORIG AUTH=PLAIN"IMAP_DISABLETHREADSORT=0IMAP_CHECK_ALL_FOLDERS=0IMAP_OBSOLETE_CLIENT=0IMAP_UMASK=022IMAP_ULIMITD=65536IMAP_USELOCKS=1IMAP_SHAREDINDEXFILE=/etc/courier/shared/indexIMAP_ENHANCEDIDLE=0IMAP_TRASHFOLDERNAME=TrashIMAP_EMPTYTRASH=Trash:7IMAP_MOVE_EXPUNGE_TO_TRASH=0SENDMAIL=/usr/sbin/sendmailHEADERFROM=X-IMAP-SenderIMAPDSTART=YESMAILDIRPATH=Maildir
mv /etc/courier/imapd-ssl{,.default}vi /etc/courier/imapd-ssl
Copy/paste the following (change mail.example.com):
SSLPORT=993SSLADDRESS=0SSLPIDFILE=/var/run/courier/imapd-ssl.pidSSLLOGGEROPTS="-name=imapd-ssl"
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
9 din 44 10/04/2013 14:49
-
IMAPDSSLSTART=YESIMAPDSTARTTLS=YESIMAP_TLS_REQUIRED=0COURIERTLS=/usr/bin/couriertlsTLS_KX_LIST=ALLTLS_COMPRESSION=ALLTLS_CERTS=X509TLS_CERTFILE=/etc/ssl/private/mail.example.com.pemTLS_TRUSTCERTS=/etc/ssl/certsTLS_VERIFYPEER=NONETLS_CACHEFILE=/var/lib/courier/couriersslcacheTLS_CACHESIZE=524288MAILDIRPATH=Maildir
mv /etc/courier/pop3d{,.default}vi /etc/courier/pop3d
Copy/paste the following (no changes required):
PIDFILE=/var/run/courier/pop3d.pidMAXDAEMONS=40MAXPERIP=4POP3AUTH="LOGIN"POP3AUTH_ORIG="PLAIN LOGIN CRAM-MD5 CRAM-SHA1 CRAM-SHA256"POP3AUTH_TLS="LOGIN PLAIN"POP3AUTH_TLS_ORIG="LOGIN PLAIN"POP3_PROXY=0PORT=110ADDRESS=0TCPDOPTS="-nodnslookup -noidentlookup"LOGGEROPTS="-name=pop3d"POP3DSTART=YESMAILDIRPATH=Maildir
mv /etc/courier/pop3d-ssl{,.default}vi /etc/courier/pop3d-ssl
Copy/paste the following (change mail.example.com):
SSLPORT=995SSLADDRESS=0SSLPIDFILE=/var/run/courier/pop3d-ssl.pidSSLLOGGEROPTS="-name=pop3d-ssl"POP3DSSLSTART=YESPOP3_STARTTLS=YESPOP3_TLS_REQUIRED=0COURIERTLS=/usr/bin/couriertlsTLS_STARTTLS_PROTOCOL=TLS1TLS_KX_LIST=ALLTLS_COMPRESSION=ALLTLS_CERTS=X509TLS_CERTFILE=/etc/ssl/private/mail.example.com.pemTLS_TRUSTCERTS=/etc/ssl/certsTLS_VERIFYPEER=NONETLS_CACHEFILE=/var/lib/courier/couriersslcacheTLS_CACHESIZE=524288MAILDIRPATH=Maildir
We need to create SSL certificates for Courier to use when authenticating using SSL/TLS. You can
either purchase these (to prevent invalid certificate warnings) or generate a self-signed
certificate which is just as secure, and free.
Run the following (change mail.example.com):
# Remove default certificatesrm -f /etc/courier/imapd.cnfrm -f /etc/courier/imapd.pemrm -f /etc/courier/pop3d.cnfrm -f /etc/courier/pop3d.pem
# Generate a new PEM certificate (valid for 10 years)openssl req -x509 -newkey rsa:1024 -keyout "/etc/ssl/private/mail.example.com.pem"
# Generate a new CRT certificate (valid for 10 years)openssl req -new -outform PEM -out "/etc/ssl/private/mail.example.com.crt" -newkey
chmod 640 /etc/ssl/private/mail.example.com.*
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
10 din 44 10/04/2013 14:49
-
chgrp ssl-cert /etc/ssl/private/mail.example.com.*
You will be prompted to input some information about the certificates you create. You can enter
any information you want here except Common Name (CN) which must be your mailname (e.g.
mail.example.com).
Next well configure Amavis, the software that ties together SpamAssassin and ClamAV with
Postfix.
adduser clamav amaviscat /dev/null > /etc/amavis/conf.d/15-content-filter-modevi /etc/amavis/conf.d/15-content-filter-mode
Copy/paste the following (no changes required):
use strict;
@bypass_virus_checks_maps = ( \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
@bypass_spam_checks_maps = ( \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
1;
cat /dev/null > /etc/amavis/conf.d/50-uservi /etc/amavis/conf.d/50-user
Copy/paste the following (no changes required):
use strict;
@local_domains_acl = qw(.);$log_level = 1;$syslog_priority = 'info';$sa_kill_level_deflt = 6.5;$final_spam_destiny = D_DISCARD;$pax = 'pax';
1;
mv /etc/default/spamassassin{,.default}vi /etc/default/spamassassin
Copy/paste the following (no changes required):
ENABLED=1OPTIONS="--create-prefs --max-children 5 --helper-home-dir"PIDFILE="/var/run/spamd.pid"CRON=0
dpkg-reconfigure clamav-freshclam
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
11 din 44 10/04/2013 14:49
-
Choose OK
Choose daemon
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
12 din 44 10/04/2013 14:49
-
Choose a mirror closest to you.
Enter your proxy, if required. Usually you will leave this blank.
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
13 din 44 10/04/2013 14:49
-
By default, ClamAV updates every hour. Thats excessive. Bring that down to once a day.
Choose No
Now restart everything.
/etc/init.d/saslauthd restart/etc/init.d/postfix restart/etc/init.d/courier-authdaemon restart/etc/init.d/courier-imap restart/etc/init.d/courier-imap-ssl restart
Thats it, youre done!
You can test your setup by configuring your mail client to connect to your new mail server using
[email protected] as your username and the password you chose (changeme in the guide).
Errors will usually show up in /var/log/mail.log or post any problems youre having in acomment and Ill try my best to help.
For more information regarding the mail database, testing using Telnet, and more information
regarding how all these services are stitched together, please see Flurdys guide.
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
14 din 44 10/04/2013 14:49
-
Did you enjoy this article? Share it!Did you enjoy this article? Share it!
About the Author: About the Author: Adam PancuttAdam Pancutt
I'm addicted to everything web: design, user interfaces, backend development and systemI'm addicted to everything web: design, user interfaces, backend development and system
administration. My expertise lies in the LAMP stack, UI development and scalability.administration. My expertise lies in the LAMP stack, UI development and scalability.
+ ADD COMMENT160 Comments
Kozley March 11, 2011 at 4:56 am
Hi!
This is works for me. I have one question How do I add more users?
Adam March 11, 2011 at 5:22 pm
Hi Kozley,
To add more users (mailboxes), simply add them to the database you created or use SQL
to insert them directly.
Some examples
Adding a new mailbox for [email protected] with a password of helpme
INSERT INTO `user` (`email`, `password`, `name`, `quota`, `enabled`) VALUES
([email protected], ENCRYPT(helpme), Example Helpdesk, NULL, 1);
Adding [email protected] as an alias for [email protected] (e-mails sent to
support will be forwarded to helpdesk):
INSERT INTO `alias` (`source`, `destination`, `enabled`) VALUES
([email protected], [email protected], 1);
Adding a new mailbox for a new domain [email protected]:
INSERT INTO `user` (`email`, `password`, `name`, `quota`, `enabled`) VALUES
([email protected], ENCRYPT(helpme), Example Helpdesk, NULL, 1);
INSERT INTO `domain` (`domain`, `transport`, `enabled`) VALUES
(examplenewdomain.com, virtual:, 1);
(Note that you need to add the new domain to the `domain` table).
Let me know if you have any more problems.
Richard March 16, 2011 at 1:16 pm
Gday,
Can you tell me how I I can forward mail using wildcards (if its even possible with this
setup)?
E.g. I want something like all mail coming from an email address with twitter.com in
the address gets forwarded to [email protected]
Cheers,
Richard
Adam March 16, 2011 at 1:44 pm
As far as I know, this isnt possible without creating some form of content filter.
There may be scripts available to help you get started but Ive not used anything
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
15 din 44 10/04/2013 14:49
-
like that myself.
Richard March 16, 2011 at 8:37 pm
No worries. Thanks Adam!
krish March 24, 2011 at 8:06 am
please help me .am in greate need
krish March 24, 2011 at 8:06 am
you also
Javier March 2, 2013 at 11:21 am
Hello,
I have installed everything mentioned following the tutorial and trying to
configure the client, does not work. the client works nevertheless with
gmail.
could you please give me a clue?
thanks
Regards
Heitor Silva March 18, 2011 at 1:42 pm
Man, you saved me! Thanks very very very much
I was trying to configure Postfix with all this stuff since 03/16
Very good article
krish March 22, 2011 at 12:05 pm
1. If i dont want to use ssl/tls , spamassasin,calmvs and amvis then how will the setting
will look like?
2. Is there no need for firewall setting?
krish March 22, 2011 at 12:10 pm
Is different system have different gid and uid? If yes how to find them?
Adam April 12, 2011 at 11:26 am
Hi Krish,
Sorry for the delay getting back to you. Are you still having problems? Ill try my
best to help you out.
Adam
krish April 25, 2011 at 11:15 am
Yes, Adam
I still have a problem . Im getting frustated by searching internet and get
all that same result.
I use above setting but still am confused why my server is not working.
By the way which user id and password while trying to login to the account
created in the database.
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
16 din 44 10/04/2013 14:49
-
Krish
rabble May 30, 2011 at 7:08 pm
when I try to restart postfix I get the following fail message:
* Stopping Postfix Mail Transport Agent postfix postfix: fatal: /etc/postfix/main.cf, line
74: missing = after attribute name: smtp inet n smtpd
[fail]
this is related to the Master Process configuration section above.
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: man 5 master).
#
# Do not forget to execute postfix reload after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n smtpd
-
I dont know why no one else has noticed this.
indowaras June 4, 2011 at 4:10 pm
@rabbel you forget to add # on first line on /etc/postfix/main.cf.
after you changes that and restart postfix the proble should be gone now ;)
and one more question how about squirrelmail, because they use auth plain and
cram 5 , can this tutorial working on that.
Thanks sob for great articel.
rabble June 9, 2011 at 11:42 pm
I actually discovered I had copied configuration details to main.cf instead
of to master .cf
When I corrected that. I stopped having the errors I mentioned.
Thanks for getting me to take a fresh look.
Joan June 8, 2011 at 5:45 pm
hola, I am trying to up a vmware with ubuntu 10.04 desckop mail server but have some
problems with the virtual ip and some other configurations, does any one did it with a
virtual machine and can say that this really works?
thanks, Joan
lbermudez November 6, 2011 at 7:05 pm
2 questions
1 How to I get thunderbird to get my mail. I have
admin for user name
[email protected] for email
used changeme and mailuserpassword for password
thunderbird failed to find settings for your email account. is the error i get.
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
17 din 44 10/04/2013 14:49
-
I have posted more details at
http://ubuntuforums.org/showthread.php?p=11423216
http://www.linuxforums.org/forum/ubuntu-linux/184177-postfix-thunderbird-help.html
2 How do I add new user? Im using ubuntu 11.10 and I need a step my step this is new
for me.
erictr1ck July 20, 2012 at 3:49 pm
have you ever figured out the correct setting for thunderbird?
widplay November 28, 2011 at 11:32 am
Error here:
mv /etc/courier/imapd /etc/courier/imapd .default
will be:
mv /etc/courier/imapd /etc/courier/imapd.default
Adam November 28, 2011 at 11:35 am
Thanks thats fixed.
Jorge November 28, 2011 at 8:59 pm
Thanks a bunch. This is a great tutorial and it works. I tried flurdys before but didnt
work for me. Ive found this one much better.
Ive followed exactly the same configuration as the tutorial with no problems and no
errors. Then Ive sent an email from my gmail account and I can read it when I connect
through telnet. I mean (lets say my server is mail.example.com):
telnet mail.example.com 143 (WORKS OK)
openssl s_client -connect mail.example.com:993 (WORKS OK)
I can login and fetch the email I sent from my gmail account if I telnet to 143 or 993
ports.
Now Im trying to retrieve my email from Thunderbird 8.0. This is my account config:
Server Name: mail.example.com
Port: 993
Connection security: SSL/TLS
Authentication method: Encrypted password
Then thunderbird says my server does not seem to support encrypted passwords and
suggests to change to Normal password. If I do that, then thunderbird says Login Failed
and invites me to enter another password.
Can you point me in the right direction? Also, cat /etc/hostname shows the Amazon EC2
private dns. Should I change it to mail.example.com?
Best Regards!
Adam November 28, 2011 at 9:54 pm
You should set Thunderbird to use Normal password, however, your credentials
will still be sent encrypted by TLS/SSL to keep them protected.
Have a look in your log files, theyre usually quite verbose so should be able to
give you an idea where login is failing. In particular, check out /var/log/mail.err.
There is more info in Flurdys guide on how to enable more verbose logging for
authentication modules if needed. Feel free to paste logs here if you want some
more help. Just be careful to remove anything sensitive first.
The hostname in /etc/hostname should not affect your setup and Id advise you
dont change it. The hostname in /etc/mailname, however, is more important
and should be a publicly-resolvable FQDN (i.e. you should be able to ping the
hostname from a machine outside the EC2 network).
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
18 din 44 10/04/2013 14:49
-
You could try overriding the hostname just for Postfix by adding the following
line to the top of /etc/postfix/main.cf
myhostname = mail.example.com
I doubt, however, that this is the cause of your login problems. Best to have a
look at those logs. Good luck!
Jorge November 29, 2011 at 11:52 am
I reinstalled the whole thing and it still fails in Thunderbird, but if I use
Outlook instead, I can get mail from my server and send mail to my server.
So it has to be something related to Thunderbird. Weird.
But the big trouble now is when I try to send mail to gmail or hotmail,
then I get the error Relay access denied.
The /var/log/mail.log file shows
postfix/smtpd[17958]: NOQUEUE: reject: RCPT from : 554 5.7.1 : Relay
access denied from= to= proto=ESMTP helo=
There is nothing related to the problem in /var/log/mail.err
Any ideas?
Thanks a lot.
Jorge November 30, 2011 at 11:23 am
I see. My machine is a EC2 Amazon instance and it seems there are
some issues related to reverse dns and this error.
Thanks again for your tutorial. Its very good.
Andrei April 1, 2013 at 6:46 am
Hello, Adam,
can I use this tutorial to login to mail accounts using only TLS Certificiates?
The idea is when i am on my pc i have already installed my X.509
certificate and i would like to login (using thunderbird) to my mail?
Alex Ball December 3, 2011 at 8:06 pm
Many thanks for this guide. Ive been struggling to set up a fairly simple mail server for
two days on my own, until finally giving up, and after a brief search for help, this post
came up.
Im not sure where I was going wrong, but after a clear out and re-install, and following
your instructions, were all up and running nicely.
Cheers!
Stefan Marin December 6, 2011 at 1:21 pm
Thanks for your excelent tutorial.
Still, I have one question about what if I need that all users to be real users, with
physical user accounts attached? (i.e. created by adduser)
Is anything I should change/remove?
Thank you verry much!
Have a nice day!
Spacio December 20, 2011 at 11:03 pm
Hi, you have wrote a very good tutorial !
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
19 din 44 10/04/2013 14:49
-
Ive found that All spam is directly deleted without any warningeven false positive
mails
Im just trying now to deliver all the spam in the spam-folder for every virtual user,
which would be more safe.
Could you please give me any advice for this setup ?
Thanks a lot
Spacio
Adam December 23, 2011 at 10:24 am
Hi Spacio,
Thats the behaviour expected using the configuration above. To tweak for your
requirements, open up /etc/amavis/conf.d/50-user
Then, add the following line:
$spam_quarantine_to spam\@mydomain.com;
Youll need to make sure that the spam mailbox exists, too. Just add a row in
the user MySQL table.
Note that if a spam_quarantine_to value is provided, using final_spam_destiny =
D_DISCARD will prevent the message arriving at the intended destination but a
copy will be sent to the spam mailbox. I assume this is the behaviour youre
after.
Good luck!
Adam
webhost review December 27, 2011 at 7:28 pm
Thanks Adam for this extra line of code, saved me hours of work!
nob August 29, 2012 at 9:21 pm
What if you have more than one domain running on the mailserver?
Then you cant use $spam_quarantine_to spam\@mydomain.com;
anymore
How do you cope with that?
And how do I route the spam for a mailbox to a spam folder in that
mailbox?
So that every user for themself can see if the spam is really valid spam.
Espacio linux Blog Archive nuevo December 23, 2011 at 6:52 pm
[...] En este tutorial se explica de forma completa como preparar un servidor de correo
completo con antivirus, antispam, [...]
Rahul Patel January 5, 2012 at 6:29 am
i followed the guide to the word with the exception of substituting some areas with my
name. when i went to test the settings in thunderbird all the info came up the way it
was set up but the password could not be recognized and i went through all the
instances in which mailuserpassword had to be changed if i could get some assistance
Greg K February 23, 2012 at 8:31 pm
Just an ideaTry [email protected] instead of admin maybe?
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
20 din 44 10/04/2013 14:49
-
zicklon February 26, 2012 at 9:21 pm
Hi,
Im encountering a problem while trying to connect using thunderbird,
the username and the password is invalid.
Ive tried with a new user but impossible to connect to the server
Can you please help me ?
ric March 2, 2012 at 12:57 am
adduser clamav amavis
rm -f /etc/amavis/conf.d/15-content-filter-mode
vi /etc/amavis/conf.d/15-content-filter-mode
had to modify this to:
adduser clamav amavis
rm -f /etc/amavis/conf.d/15-content_filter_mode
vi /etc/amavis/conf.d/15-content_filter_mode
and
vi /etc/amavis/conf.d05-node_id
mod;
#$myhostname = mail.example.com;
to;
remove comment and add your FQDN
Daniel March 2, 2012 at 6:55 pm
hey, great howto :)
but I got a Problem :( everything is great, but then comes a error when I want to
connect with thunderbird username or password invalid.
in log-files, these errors are shown:
Disconnected, ip=[::ffff:87.181.121.99], time=1
statistics: max cache size 2 at Mar 2 19:37:38
statistics: max connection count 4 for (smtp:87.181.121.99) at Mar 2 19:37:38
help me please ;)
thanks :)
ric March 3, 2012 at 3:44 am
Logging into [email protected] no problem.
Created a new user with:
INSERT INTO `user` (`email`, `password`, `name`, `quota`, `enabled`) VALUES
([email protected], ENCRYPT(blahblah), user, NULL, 1);
Attempted to login with squirrelmail and it failed.
Looked at the /var/log/mail.log to find:
chdir mydomain.com/ric/: No such file or directory
[email protected]: No such file or directory
I assuming the /var/spool/mail/virtual/mydomain.com/ric directory was not created
because I do have an admin from the previous work we did.
Is it as simple as creating a folder or do we need to do something else to get the proper
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
21 din 44 10/04/2013 14:49
-
directory structure? Maybe I missed a step?
Thanks
Ric
ric March 3, 2012 at 1:47 pm
SOLUTION:
You have to send your new account that was created an email from another
account so that the directory structure gets created. Send a test message from
an online email that you might have and after you should be able to login with:
username @ yourdomain . com
password
Ric
Stan March 9, 2013 at 11:02 pm
Ric you are a star!
This how to has worked really well but I needed this last bit to set up
the directory structure.
All is working now, thanks a million !!
zicklon March 3, 2012 at 9:03 am
Hi ,
Im encountering the same problem as you with the password,
Have you found a solution or else ?
ric March 3, 2012 at 1:36 pm
I would look at your log file in one terminal prompt with this command:
tail -f /var/log/mail.log
Attempt to log in again with @.com through squirrelmail. If you get:
chdir .com//: No such file or directory
@.com: No such file or directory
Then it would appear the folder structure for this account has not been created.
Im hoping someone has a solution and can share. It might be as easy as making
the dir ourselves and the sub dirs will create themselves with courier/postfix?
Not sure which one would.
Ric
ric March 3, 2012 at 1:40 pm
posted again because it didnt like my references.
I would look at your log file in one terminal prompt with this command:
tail -f /var/log/mail.log
Attempt to log in again with username @ yourdomain.com through
squirrelmail. If you get:
chdir yourdomain .com/ username /: No such file or directory
username @ yourdomain.com: No such file or directory
Then it would appear the folder structure for this account has not been
created. Im hoping someone has a solution and can share. It might be as
easy as making the dir ourselves and the sub dirs will create themselves
with courier/postfix? Not sure which one would.
Ric
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
22 din 44 10/04/2013 14:49
-
Jason March 17, 2012 at 3:06 am
I know in my case it was that I had to send an email to the account
first, then I could use the mailbox and login. It creates the
directory when an email arrives.
Reazy April 12, 2012 at 12:40 pm
RIC you save my life !
Thanks !
Thanks for the tutorial !
Bruno March 7, 2012 at 12:41 pm
Hi, i follow step by step the tuto, tuto very good work in local but i try to send out
cannot with godaddy i am begginer in linux i try to help my company can you tell me if
with your setting i can send out the email.
Thanks in advance.
Bruno
Bruno March 28, 2012 at 12:26 pm
Problem solved problem with my mx.record thanks again for this tuto
JItendra Jha March 27, 2012 at 12:43 pm
Dear Friend,
I done all the configuration but even i add user as it is showing up side . But when i login
in SquirrelMail useing username = helpdesk and password = helpme . Giving me error
unknown username and password incorrect . Help me .
Thanks
Jitendra Jha
Bruno March 28, 2012 at 12:33 pm
If you took the example from Adam
INSERT INTO `user` (`email`, `password`, `name`, `quota`, `enabled`) VALUES
([email protected], ENCRYPT(helpme), Example Helpdesk, NULL, 1);
your login will be [email protected] (replace example.com by the domain
name that you created.
Is just an idea.
Thanks
emad March 30, 2012 at 12:03 pm
hello,
very nice guide. but since im a newbie could anyone pls tell me 2 things ?
1) how would i be able to add pop/imap email account on this postfix installation and
set its email quota.
2) im unable to see email send logs only pop logs are there in /var/log/mail.log
Urgent help needed.
Regards.
Emad
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
23 din 44 10/04/2013 14:49
-
Reazy April 12, 2012 at 12:40 pm
Thanks !
Jacob Isreal April 21, 2012 at 8:26 am
I tried this, and I can receive mail sent locally. But I cant receive mail sent from the
internet. Not sure why. Its not hitting my server, as I see in the logs. I have an MX
record configured.
Mitja April 23, 2012 at 7:39 am
When i restart postfix i always get:
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter:
virtual_maildir_limit_message=The user you are trying to reach has a full inbox. Please
try again at another time.
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter:
virtual_mailbox_limit_maps=mysql:/etc/postfix/maps/limit.cf
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter:
virtual_mailbox_limit_override=yes
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter:
virtual_overquota_bounce=yes
what is wrong?
Romain April 30, 2012 at 1:36 pm
I have the exact same warnings, have you found a solution ?
As anybody have a solution or knows why we have those errors ?
Jason P April 27, 2012 at 12:29 am
While doing the upgrade to 12.04 LTS I received errors about upgrading the courier-
pop-ssl and other ssl packages. The server still works after reboot. However, I plan to
redo all the steps of the procedure to ensure no security holes are present.
Adam April 27, 2012 at 1:08 pm
Thanks for the update Jason. Ill be upgrading next week so Ill update with any
12.04 fixes.
Adam May 10, 2012 at 11:36 pm
Sorry for the delay. The guide has now been updated to support Ubuntu 12.04.
Niksen H April 27, 2012 at 1:04 pm
Hi Adam
are you still monitoring this page?
Ive tried your tutorial, at first I used mail address as kodok.abc.com (abc is my real
domain name on the inet), edit my MX record in my web hosting via cpanel, and it
worked perfectly.
Then I changed mail address to [email protected], I also changed domain record in
MySQL domain table. Ive added sub domain it.abc.com in cpanel, redirect it.abc.com
to my server (ip public), and assigned MX record for it.abc.com to my server. But now I
only can send email to other server, and cannot receive any email (except from same
domain [email protected]).
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
24 din 44 10/04/2013 14:49
-
mail.log said chdir it.abc.com/kodok/: No such file or directory
Ive create manually same directory structure (copy from abc.com mail directory), but
it cant solve the problem
so.. is there any settings that ive missed?
Thank you,
Niksen H
Adam April 27, 2012 at 1:10 pm
Are you still getting any errors in the log?
The best way to resolve missing directories is to send an e-mail to the new
address, then try to connect to it. This method will ensure the directories are
created with the correct permissions, owners and flags.
Boniface Chacha May 13, 2012 at 7:35 am
Hi,
I am trying to connect to the new email i created but it fail to authenticate and in the
log i see the following error:
..imapd: LOGIN FAILED, user=info, ip=[::ffff:41.222.183.45]
..postfix/smtpd[10340]: fatal: open database /etc/aliases.db: No such file or directory
..postfix/master[8833]: warning: process /usr/lib/postfix/smtpd pid 10340 exit status 1
..postfix/master[8833]: warning: /usr/lib/postfix/smtpd: bad command startup
throttling
Can you please help me!
Adam May 13, 2012 at 9:50 am
Try running newaliases and try again.
Jerry May 26, 2012 at 6:10 am
Thanks a lot for a Link
I am a new to this. I followed the link, exactly as you suggested and its work for me.
My doubt, how should i proceed. How i am bale to login and send mails etc.
I have no idea. can you please guide me.
Thanks a lot in advnace
Jerry May 26, 2012 at 8:14 am
Hello
Also the authentication is ferom mysql.
Is it possible to authenticate from Active directory server.
Thanks a lot
Andrew June 7, 2012 at 3:53 am
Hey, so I followed this guide on Ubuntu 11.10 x64 and the setup worked prefectly but I
cant connect a mail client to my system.
I left the admin password as changeme, I keep getting configuration error, username /
password returned.
I have my DNS setup correctly because so far every mail client can find the two domain
names for the mail server.
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
25 din 44 10/04/2013 14:49
-
I paste binned all the information to keep it clean, any idea whats going on.
http://pastebin.com/zkke9tLy
Great guide btw, first on that was good enough to ue!
heihei June 10, 2012 at 9:13 pm
same problem on ubuntu 12.04 x64.And maby continue how-to how install squirlmail or
roundcube :)
Andrew June 10, 2012 at 10:20 pm
Okay so I got past where I was, this is my updated config: http://pastebin.com
/NzQV9z1n
This is my mail log: http://pastebin.com/07cCejCM
I can send mail but cant recieve it, I cant figure this out :-( any idea?
Christopher Duff-harper December 6, 2012 at 11:20 pm
i am having the same problem. have you found a solution for it yet?
Andrew June 10, 2012 at 10:40 pm
Got it! I had to take reject out of the SMTP_RESTRICT, Once I took that out it worked.
heihei June 13, 2012 at 7:14 pm
i try install squirlmaIl . but i cant login
in /var/log/mail.err
Jun 13 21:11:06 dimetil imapd: [email protected]: No such file or directory
and in in mail.log
Jun 13 21:11:06 dimetil imapd: Connection, ip=[::ffff:176.9.207.173]
Jun 13 21:11:06 dimetil imapd: chdir dimetil.lv/admin/: No such file or directory
Jun 13 21:11:06 dimetil imapd: [email protected]: No such file or directory
Jun 13 21:11:19 dimetil imapd: Connection, ip=[::ffff:176.9.207.173]
Jun 13 21:11:19 dimetil imapd: LOGIN FAILED, user=admin, ip=[::ffff:176.9.207.173]
Jun 13 21:11:24 dimetil imapd: LOGOUT, ip=[::ffff:176.9.207.173], rcvd=44, sent=332
kro June 16, 2012 at 10:12 pm
Great short tutorial. I try it on Ubuntu 12.04 and its working. Great. Now stating
resolve webmail setup :)
Cannot connect to Ubuntu Courier-IMAP server from Thunderbird |eeYogo @ yo' service June 22, 2012 at 11:04 am
[...] http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-using-postfix-
courier-ssltls-spamas [...]
LarsM July 2, 2012 at 9:56 pm
Maybe add a /et/intit.d/clamav-* restart also.. Took me some hours to figure out that
this was the reason that it could not find the user..
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
26 din 44 10/04/2013 14:49
-
(it defaults to run after reset, but I guess the reconfigure stops it.)
Norbert Seibert July 4, 2012 at 6:46 pm
Easy to follow HowTo, however I ran into the same problem as some others reported.
Everything is configured accrodingly and I re-checked several times, looking for typos
etc. The only thing I can think of is that there is some persistent previous setting that
messes everything up. I am running MySQL 5.5 (latest) on Ubuntu 12.04 (up to date) and
use MyPhpAdmin (Its a lot easier to see things!). My tests from the localhost work fine,
I can send mail from the console to an extern e-mail. Sending back causes a Reject e.g.
my ISP is rejected from my Server. Setting up an e-mail account using Thunderbird
fails too. Cant verify the password or username! Seems as if it cant connect/read the
database? I am horsing for a long time around to find a HowTo that works, without
success. I had it somewhat working before with dovecot and guess what? Dovecot
decided to change their software, making it useless and leaving it krippled for me. By
the time I get something to work, there is an update that pretty much destroys my work
and I have to start from the beginning again. Full time job to setup a mail server with
MySQL
I have absolutely no clue why this HowTo fails?
Cheers,
Norbert
Krzysztof July 5, 2012 at 4:36 pm
Hi,
After trying to restart postfix I get error message postfix: fatal: /etc/mailname: cannot
open file: No such file or directory
I probably missed something along the way but I dont know what.
Krzysztof July 5, 2012 at 5:12 pm
Ok, I missed # ;)
HU Hao July 5, 2012 at 8:19 pm
Could you tell me how to configure the hostname and DNS for a server whose domain
name is example.com
Tadas July 6, 2012 at 4:22 pm
after inserting users to mysql databse, i cant connect to imap. Log does not write
anything. It just say wrong username or password.
Steeve DOMINIQUE July 13, 2012 at 5:44 pm
Dear all,
First I would like to thank you for you tutotial.
I have done all the steps stated on the tuto but I cannot connect any Mail client to the
Mail server. When I try with Thunderbird, it keeps displaying cannot connect. I tried
Evolution, nothing so far.
Can you please provide which Mail client you have to use and also all the step for
configuring that mail client.
Thank you in advance.
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
27 din 44 10/04/2013 14:49
-
Jason Pate July 14, 2012 at 1:50 am
Ok, I have a fresh install of Ubuntu 12.04. I have this working on two 11.10 installs. I
install this and I can send email just find but receive I get the following error. Any help
or advice is greatly appreciated. Have a great week.
Jul 13 19:40:12 mtbe postfix/smtpd[3798]: connect from imr4.er.com[196.34.60.90]
Jul 13 19:40:12 mtbe postfix/smtpd[3798]: NOQUEUE: reject: RCPT from
imr4.er.com[196.34.60.90]: 554 5.7.1 : Sender address rejected: Access denied; from=
to= proto=ESMTP helo=
Jul 13 19:40:14 mtbe postfix/smtpd[3798]: disconnect from imr4.er.com[196.34.60.90]
IPs and server names changed of course but other than that, exact.
Jason Pate August 8, 2012 at 2:11 am
Ok, on both my 11.10 and 12.04 servers my mail had stopped working on
receiving email with error NOQUEUE: reject: RCPT from sender address rejected.
I found a way to get it to receive emails but I had to change /etc/postfix/main.cf
to the following:
smtpd_sender_restrictions =permit_sasl_authenticated,
permit_mynetworks,permit
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks,
reject_unauth_destination
Can anyone explain whey I had to change the last word to permit from reject to
get this to work again. It worked before without any errors. Did normal updates
from Ubuntu and it stopped working with the above error.
Chris July 14, 2012 at 4:28 am
Hi,
Very good guide, thanks a lot.
But I seem to have a problem. When I try to log in with [email protected], I get the
following errors in mail.log:
Jul 14 03:21:16 5 imapd: Connection, ip=[::ffff:86.140.88.215]
Jul 14 03:21:16 5 imapd: chdir mydomain.com/chris/: No such file or directory
Jul 14 03:21:16 5 imapd: [email protected]: No such file or directory
I dont know why I cant connect
I think mail is being delivered though. Where would it be stored?
Thanks,
Chris
Navneet Kumar July 14, 2012 at 10:29 am
When i try to send mail from any of my computer which are in LAN. I get following error
in error log
Jul 14 14:52:49 fw5 postfix/smtpd[2640]: connect from unknown[192.168.1.104]
Jul 14 14:52:49 fw5 postfix/smtpd[2640]: NOQUEUE: reject: RCPT from
unknown[192.168.1.104]: 554 5.7.1 : Sender address rejected: Access denied; from= to=
proto=ESMTP helo=
Jul 14 14:52:49 fw5 postfix/smtpd[2640]: disconnect from unknown[192.168.1.104]
Its not accepting mails from any user outside the network
Jason Pate July 19, 2012 at 8:52 pm
Navneet, did you get this corrected?
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
28 din 44 10/04/2013 14:49
-
john July 14, 2012 at 4:24 pm
I tried to setup mail server on Ubuntu server following the tutorial. The tutorial is very
clear and easy to follow and no issues or problems during the installation. But when I
test the server, after installation, I kept receive the following login error:
pop3d: LOGIN FAILED, user=admin, ip=[::ffff:184.72.226.23]
I am quite sure that the password for admin is correct.
Could anyone share alight what may go wrong?
Steeve DOMINIQUE July 17, 2012 at 3:46 pm
Hello,
How someone can help me because I have followed this tuto step by step but when I try
to log on to the squirrel mail app I cant. Here are what I did :
usename : [email protected]
password: 1234578
ERROR: Connection dropped by IMAP server.
username: admin@business
password: 1234578
ERROR : Unknown user or password incorrect.
Please help it is urgent & thanks in advance
erictr1ck July 20, 2012 at 4:06 pm
thanks for the tutorial. however, i cannot seem to connect with my client, thunderbird.
i am getting the following error in /var/log/mail.log:
Jul 20 10:03:12 la-xperience imapd-ssl: Connection, ip=[::ffff:xxx.xxx.xxx.xx]
Jul 20 10:03:12 la-xperience imapd-ssl: couriertls: read: error:14094418:SSL
routines:SSL3_READ_BYTES:tlsv1 alert unknown ca
Jul 20 10:03:12 la-xperience imapd-ssl: Disconnected, ip=[::ffff:xxx.xxx.xxx.xx],
time=0, starttls=1
any ideas?
Free Firewall July 26, 2012 at 7:11 am
Please let me know if youre looking for a article writer for your weblog. You have some
really good articles and I believe I would be a good asset. If you ever want to take some
of the load off, Id really like to write some content for your blog in exchange
for a link back to mine. Please blast me an email if interested.
Thank you!
NiksenH July 26, 2012 at 7:56 am
Hi Adam sorry for late reply..
finally i reinstall the server, start it again from scratch. Re-setting the router, then
whallaaaa it runs perfectly
thanks for this guide
it helped me much
thank you
LarsM July 28, 2012 at 5:23 pm
Got it working without any problems. (reboot to make sure all services are started, use
telnet to send a pop3 email to create directories.)
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
29 din 44 10/04/2013 14:49
-
What happened then was that it will work for approx 10-12 hours and then appear to
freeze up.
After some digging I found out that there is an error in the gam_server daemon.
So if you kill this service, and everything is ok again do the following:
Edit /etc/courier/imapd
- Remove the word IDLE from IMAP_CAPABILITY
- change IMAP_USELOCKS=1 to IMAP_USELOCKS=0
This will probably only be a problem using thunderbird and IMAP
Noldor July 29, 2012 at 10:18 am
Hey Adam,
thank for this great guide. It works fine for me and my server ;-). I like your short and
precise style because single settings can be looked up in the manuals.
Good work! Thank you very much!
Noldor July 29, 2012 at 11:07 am
To the moderator:
I bet you to correct my typo in the scond line if my first post: thank > thanks
Many thanks! ;-)
mYoda July 29, 2012 at 1:53 pm
my first email server ever.
works like a charm after the initial mayhem.
Thanks you very much for this perfect guide.
my suggestion:
this page requires a forum.
there are so many comments (82 including this).
I dont think comments are going to stop. :)
what doesnt work?
what is the resolution?
mYoda July 29, 2012 at 1:55 pm
how to create more emails without sending a test email from another email server ?
so that directories are created for someone to login ?
Paul August 3, 2012 at 12:10 pm
Hello,
How someone can help me because I have followed this tuto step by step but when I try
to log on to the squirrel mail app I cant. Here are what I did :
usename : [email protected]
password: 1234578
ERROR: Connection dropped by IMAP server.
username: admin@business
password: 1234578
ERROR : Unknown user or password incorrect.
Please help it is urgent & thanks in advance
mYoda August 4, 2012 at 9:41 pm
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
30 din 44 10/04/2013 14:49
-
Try sending an email to that address from another email account like gmail or
yahoo etc.
I think the folders will not be created unless you do that.
Julio August 7, 2012 at 9:03 pm
Hi Adam,
Its realy need to install libauthen-sasl-cyrus-perl, If I use courier instead cyrus ?
Adrian August 9, 2012 at 12:21 am
This is a great tutorial. Thanks for this. Ive followed instructions and everything seems
fine in my little Linode Ubuntu 12.04 box, which Im using to host various sites. But, Im
sure my MX record is not right.
What MX record(s) is needed to get this going?
Thanks.
Adrian August 9, 2012 at 12:35 am
Getting this in mail.log:
Aug 8 23:29:29 churchnet postfix/smtpd[12218]: NOQUEUE: reject: RCPT from
mail-wg0-f53.google.com[74.125.82.53]: 554 5.7.1 : Sender address rejected: Access
denied; from= to= proto=ESMTP helo=
Adrian August 9, 2012 at 12:45 pm
Sorry. Got it. It was reverse DNS lookup tripping things. Ive changed rDNS setting on
Linode console and waiting for it to propagate
Julio August 9, 2012 at 3:44 pm
@Adrian I think not just rDNS, because its needed to send email from your server to
gmail. But in the record above you send mail from gmail to your server. May be you
should see smtpd_recipient_restrictions variable in /etc/postfix/main.cf ( reject permit
) See variable value in http://flurdy.com/docs/postfix/
Jason August 16, 2012 at 3:39 am
Anyone want to help? I dont see any replies lately. I still have this issue on both
servers. Any suggestions?
Aug 15 21:37:19 mtbexpert postfix/smtpd[9491]: NOQUEUE: reject: RCPT from
qmta12.westchester.pa.mail.comcast.net[76.96.59.227]: 554 5.7.1 : Sender address
rejected: Access denied; from= to= proto=ESMTP helo=
KG August 16, 2012 at 10:54 pm
Jason, try looking above in the comments at Jason Pates response fixed it for me.
Although I still have a problem with the creation of maildir when mails arrive.
Aug 16 23:50:13 vps postfix/virtual[4653]: warning: maildir access problem for
UID/GID=5000/5000: create maildir file /var/spool/mail/virtual/kvds.no/admin
/tmp/1345153813.P4653.vps: Permission denied
Aug 16 23:50:13 vps postfix/virtual[4653]: warning: perhaps you need to create the
maildirs in advance
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
31 din 44 10/04/2013 14:49
-
Aug 16 23:50:13 vps postfix/virtual[4653]: CC2612FBF8: to=, relay=virtual, delay=0.07,
delays=0.02/0.02/0/0.03, dsn=4.2.0, status=deferred (maildir delivery failed: create
maildir file /var/spool/mail/virtual/kvds.no/admin/tmp/1345153813.P4653.vps:
Permission denied)
Aug 16 23:51:30 vps imapd-ssl: Connection, ip=[::ffff:79.161.94.116]
Aug 16 23:51:30 vps imapd-ssl: chdir kvds.no/admin/: No such file or directory
Not sure how I would go about solving this, so any tips is appriciated.
KG August 16, 2012 at 11:43 pm
Scratch the above. Turned out I made a simple typo when adding permissions to
/var/spool/mail :)
Stephen August 27, 2012 at 7:17 am
Hi, I got the error info in mail.log:
pop3d-ssl: couriertls: /etc/courier/pop3d.pem: error:02001002:system library:fopen:No
such file or directory
jimmi4u September 5, 2012 at 11:02 am
Hi! Very, very nice tutorial!
I followed it exactly but Im getting this warning (and some other) and dont know how
to fix that:
postfix/trivial-rewrite warning:connect to mysql server access denied for user
mail@localhost /usingpassword yes
I tried the line:
GRANT ALL ON mail.* TO mail@localhost IDENTIFIED BY mailuserpassword;
with my current mysql password but no luck!
Can someone help me out?
Thanks!
jimmi
Frank September 30, 2012 at 6:49 am
Hello,
One of the most fragile and fragmented services Ive had to configure on Ubuntu is a
mail server. No matter which of the many guides I follow, each time I do it theres
always something not working.
I could not agree more.
This is my problem: I tried to setup logrotate to email me the log before it gets rotated.
I tried to get mailx working but, when I test it, it will not send me the emails. I test it as
follows:
mail -s Hello [email protected]. It fails every time. Therefore, I think the
problem is that I am lacking the email server.
IRAGUI November 22, 2012 at 1:39 am
Think you very much for this tutorial, i have a problem same that:
ERROR: Connection dropped by IMAP server.
the following error in /var/log/mail.log:
Nov 22 01:34:29 maiyn imapd: Connection, ip=[::ffff:127.0.0.1]
Nov 22 01:34:29 maiyn imapd: chdir domain.com/admin/: No such file or directory
Nov 22 01:34:29 maiyn imapd: [email protected]: No such file or directory
thanks!
Adam December 7, 2012 at 7:46 am
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
32 din 44 10/04/2013 14:49
-
Try sending a message to the address before attempting to login.
Christopher Duff-harper December 6, 2012 at 11:12 pm
I used this and it was very helpful but i came across an issue with receiving email from
other servers such as gmail or yahoo. any ideas would be helpful.
Adam December 7, 2012 at 7:47 am
Do you have any more information? Take a look in /var/log/mail.log for any
hints.
vysu December 18, 2012 at 7:06 am
Hi Adom,
Thank you for your tutorial.I still in a problem,i how can we create virtual users in the
virtual mailbox table.
my hostname is mail.server.com
i expecting your repley
thank you
vysu
jupitermail December 25, 2012 at 11:32 am
Hi Adam,
Hope you are still following this tutorial. I have followed your tutorial exactly without
even changing the FQDN or password. I am establishing this email server for local
network emails only and its not going to work on Internet. Unfortunately with evolution
it still says user or password incorrect. I am new to linux.
command hostname file returns: mail
while hstname -f returns: mail.example.com
Any advice will be highly appreciated.
Regards,
Michael Sweikata December 26, 2012 at 10:57 pm
Love the guide, however, I followed it to the letter (minus the parts about changing
things specific to me) and Im running into some issues. The server has a static public IP,
and the hostname of the server is set to prodserv1, and I have all of my mail
configured to go to mail.mydomain.com (A Records and MX Records accordingly). I have
a few issues, but Im not sure if theyre related to one another.
When I try to telnet on port 25 to the server, I get this output:
220 mail.mydomain.com ESMTP Postfix
EHLO mail.mydomain.com
502 5.5.2 Error: command not recognized
HELO mail.mydomain.com
250 prodserv1.mydomain.com
MAIL FROM:
250 2.1.0 Ok
RCPT TO:
554 5.7.1 : Sender address rejected: Access denied
Then if I try to have my mail client (Microsoft Outlook 2010) connect to it, I see the
certificate error (since I used a self-signed certificate) but it cant connect. I set it
manually to use IMAP, and when I check /var/log/syslog, I get:
Dec 26 22:52:24 prodserv1 postfix/cleanup[1806]: warning: connect to mysql server
127.0.0.1: Cant connect to MySQL server on 127.0.0.1 (111)
Dec 26 22:52:24 prodserv1 postfix/cleanup[1806]: warning: mysql:/etc/postfix
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
33 din 44 10/04/2013 14:49
-
/maps/alias.cf lookup error for [email protected]
Dec 26 22:52:24 prodserv1 postfix/cleanup[1806]: warning: 3B3792488F:
virtual_alias_maps map lookup problem for [email protected] deferring
delivery
Dec 26 22:52:27 prodserv1 imapd: Connection, ip=[::ffff:74.136.188.186]
Dec 26 22:52:27 prodserv1 imapd: LOGIN FAILED, user=MyUserAccountName,
ip=[::ffff:74.136.188.186]
I checked the configuration file for alias.cf, and it mirrors exactly what you have in your
configuration, and I have confirmed that MySQL is running and accessible. Also, Im not
sure if Ive configured things correctly, since I want the email addresses to be
[email protected], the MX Records for mydomain.com should point to
mail.mydomain.com, but I dont want the e-mail addresses to be
Any tips or advice would be appreciated!
woodsby December 31, 2012 at 11:09 pm
I am also having the login failed issue over popd. I have combed through the logs,
and this seems to be my only remaining issue. I am on ubuntu 12.04. I am trying
to log in as the username (not the full email address). Even when i telnet in, it
tells me login failed.
Any thoughts?
Pablo January 11, 2013 at 9:21 pm
Did you figure this out? I also get the mysql connection error with no logic
reason:
Jan 11 21:18:48 localhost postfix/cleanup[12846]: warning: connect to
mysql server 127.0.0.1: Cant connect to MySQL server on 127.0.0.1 (110)
Pablo January 11, 2013 at 9:35 pm
I was able to fix the mysql connection error. It was caused by my iptables firewall
rules. What I did was add the loopback access:
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
still after that not working well, but its a progress
nick January 3, 2013 at 9:07 pm
mhh, keep getiing: -ERR Temporary problem, please try again later when i try
netcat mail.example.com 110. any suggestions? ty for the guide btw!!
woodsby January 6, 2013 at 7:57 pm
I got my previous issue figured out copy/paste issue. However, whenever I send an
email, the from field only shows [email protected]. How do I set this up so the from
field shows the users full real name?
Pablo January 11, 2013 at 9:58 pm
Yes finally got it working for receiving email. still get login error on sending.
One of the things I had to do was follow the solution here: http://ubuntuforums.org
/showthread.php?t=1277902
Pablo January 14, 2013 at 10:31 pm
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
34 din 44 10/04/2013 14:49
-
Ok receiving works good. If the password is changeme, I enter that password and get
access to the inbox.
BUT when sending its like the encryption doesnt work at all. In order to authenticate
myself for sending email I have to enter the encrypted password (the result of
ENCRYPT(changeme).
Its like that whole pam configuration from the tutorial doesnt work. I have done
exactly as explained in the guide.
Adam January 15, 2013 at 9:31 am
Can you double-check the contents of your /etc/pam.d/smtp file. Boths lines
should contain crypt=1.
Pablo January 18, 2013 at 8:46 pm
thanks I had a silly error in smtp.conf, had check_ instead of pwcheck_ at the
beginning.
Im running into other issue now, the quotas I define in the DB are not respected. I read
the unit there is bytes, so I set for instance a quota of 1 for a user, then send that user
an email with a 8MB attachment, and the email is still received :s
This means a spammer could overload the mailbox until my entire drive is full!!
Pablo January 21, 2013 at 7:10 pm
Hi Adam. Are you sure nothing else needs to be done with the quota field of the DB? In
my installation it doesnt respect the quota field at all. Ive done the exact steps from
the tutorial.. everything else works.
Adam January 22, 2013 at 12:33 pm
Ive not actually tested the quota features as I dont personally enforce them.
However, I think Ive found whats missing.
Please could you try the following and let me know if it works:
1) Add the following lines to /etc/postfix/main.cf
virtual_mailbox_limit_maps = mysql:/etc/postfix/maps/limit.cf
2) Create a new file at /etc/postfix/maps/limit.cf with the following contents:
user=mail
password=ENTER PASSWORD HERE
dbname=mail
table=user
select_field=quota
where_field=email
hosts=127.0.0.1
additional_conditions=and enabled = 1
3) Restart postfix
Let me know how it goes. You may need to apply the VDA patch
(http://vda.sourceforge.net/) and rebuild Postfix. Im hoping that patch is no
longer required
Pablo January 22, 2013 at 3:02 pm
Thanks Adam for your response.
I already got it fixed with help. Someone who helped me to fix this told me in Ubuntu
the quota feature is not supported, so we downloaded the debian sources for Postfix,
downloaded the patch from here: , rebuilt and then it worked.
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
35 din 44 10/04/2013 14:49
-
The steps I followed, in case it helps anyone:
1-edit /etc/apt/sources.list and add:
deb ftp://ftp.pucpr.br/debian wheezy main contrib non-free
deb-src ftp://ftp.pucpr.br/debian wheezy main contrib non-free
2-apt-get update
3-cd /usr/src
4-apt-get source postfix
5-wget http://vda.sourceforge.net/VDA/postfix-vda-v11-2.9.1.patch
6-cd postfix-2.9.3
7-patch -p1 < ../postfix-vda-v11-2.9.1.patch
8-vim debian/rules change export DEB_BUILD_HARDENING=0
9-dpkg-buildpackage
10- cd ..
11- dkpg -i postfix-2.9.3-2.1_i386.deb
12- dkpg -i postfix-mysql_2.9.3-2.1_i386.deb
13- restart all services, for me this worked.
Magnus February 2, 2013 at 12:16 am
OK, I cant get this to work. I followed all the instructions and Im quite happy that I did
every step. I have added a new domain and a new user and Ive double checked to see
that theyve made it into the database!
I get the following error when trying to email:
The error that the other server returned was:
554 5.7.1 : Sender address rejected: Access denied
Am I doing something stupid? Thanks in advance.
Magnus February 2, 2013 at 12:56 am
Also, when I check the account in Outlook, I cant logon so i get the error:
Log onto incoming mail server (POP3): Your e-mail server rejected your login. Verify
your user name and password for this account in Account Settings. The server
responded: -ERR chdir mydomain.com/info/ failed
martin February 3, 2013 at 2:04 am
I am trying to get this emai to work and am getting the login issues. (access denied,
server rejected login)
does anyone have any solutions??
Pandiaraj February 11, 2013 at 5:26 am
hi dude.
i am new in this email server setup..i finished like ur procedure only but it did nt work
in thunderbirdplease help me..
Dani V.C February 14, 2013 at 2:29 pm
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
36 din 44 10/04/2013 14:49
-
Hey Adam,
Thanks for this great guide. It works fine.
Good work!
Dani
Peejanz February 15, 2013 at 11:43 am
Hi Adam, I followed you instructions to the book. Now i want to find out how i can make
this mailserver a frontend to Microsoft Exchange. What it must basically do is forward
all mails that it receives to an exchange server. You response will be appreciated.
Toan Nguyen February 18, 2013 at 11:57 am
Thank you Adam for your excellent tutorials.
Ive followed through your tutorials and nearly get through with it. I can send out mail
to my hotmail account from telnet. But I have problem receiving mails. It seems that
postfix cant connect to mysql to retrieve the virtual user information. Below is the tail
of mail.log for your info:
Feb 18 11:43:26 ip-10-130-71-35 postfix/qmgr[6335]: 2D05347E75: from=, size=1608,
nrcpt=1 (queue active)
Feb 18 11:43:26 ip-10-130-71-35 amavis[972]: (00972-01) FWD via SMTP: -> ,BODY=7BIT
250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 2D05347E75
Feb 18 11:43:26 ip-10-130-71-35 postfix/virtual[7176]: error: open /etc/postfix
/maps/user.cf: Permission denied
Feb 18 11:43:26 ip-10-130-71-35 amavis[972]: (00972-01) Passed BAD-HEADER,
[113.173.10.137] [113.173.10.137] -> , quarantine: l/badh-lMhRvarfMvbi, mail_id:
lMhRvarfMvbi, Hits: 2.287, size: 556, queued_as: 2D05347E75, 794 ms
Feb 18 11:43:26 ip-10-130-71-35 postfix/smtp[7170]: 212A647E66: to=,
relay=127.0.0.1[127.0.0.1]:10024, delay=2.6, delays=1.7/0.03/0.03/0.79, dsn=2.0.0,
status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as
2D05347E75)
Feb 18 11:43:26 ip-10-130-71-35 postfix/qmgr[6335]: 212A647E66: removed
Feb 18 11:43:26 ip-10-130-71-35 postfix/virtual[7176]: warning: mysql:/etc/postfix
/maps/user.cf is unavailable. open /etc/postfix/maps/user.cf: Permission denied
Feb 18 11:43:26 ip-10-130-71-35 postfix/virtual[7176]: warning: mysql:/etc/postfix
/maps/user.cf lookup error for [email protected]
Feb 18 11:43:26 ip-10-130-71-35 postfix/virtual[7176]: warning: table
virtual_mailbox_maps: lookup [email protected]: Permission denied
Feb 18 11:43:26 ip-10-130-71-35 postfix/virtual[7176]: 2D05347E75: to=, relay=virtual,
delay=0.13, delays=0.03/0.02/0/0.08, dsn=4.3.5, status=deferred (mail system
configuration error)
Please could you or someone here help me out. I have been very desparate in finding a
solution, but have reached no positive result yet.
For your info: I am hosting this on EC2, Ubuntu 12.0.4 LTS. The rest is done as per this
tutorial.
Thanks.
Stu February 21, 2013 at 12:29 am
Hi dude, I hope this thread is still active. And hope that you can offer some help. I have
a rather unforgiving and strange problem 1. I couldnt connect to the server with
Thunderbird, I went though the comments, I sent an email through my google account
with the hope that it will create a directory. I got no love from the server. Later I
learned it could be something to do with the reverse DNS since I use linode, 28 hrs later
no love form the mail server. at one point i` had an access denoed, I tweeked the
settings in main.cf as per the comments. now I send emails to the server, they dont get
rejected, there is no directories created, the mail.log and mail.err are quiet as in there
is nothing happening there. I dont know where to look next. can you help. I dont know if
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
37 din 44 10/04/2013 14:49
-
this will be useful but I can telnet into the server through telnet server.com 25
I get
onnected to stumphafe.com.
Escape character is ^].
220 machinename.localdomain ESMTP Postfix
EHLO mail.server.com
250-machinename.localdomain
250-PIPELINING
250-SIZE
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
what is the meaning of this
Rakesh vijayan February 22, 2013 at 11:33 am
Hi Adam firstly I appreciate your knowledge , I read this topic I need to try to configure
it on my server ,before that I have some
clarification or knowledge about domain setup who you set up your mail.example.com
did you make example.com in your local machine .
will you share your knowledge In mail pointing in our domain that we created in our lan
,if You do so more people include me will get clear clarification of how mail server work
with domain
Martin February 25, 2013 at 5:59 am
I got it to work. I believe the reject is wrong in /etc/postfix/main.cf. I changed mine
to reject_unauth_destination.
The issue I am having currently is being able to use the SMTP server. I cannot seem to
be able to send emails from other accounts to anywhere outside of my domain. Because
of this I installed squirrel mail and it works wonderfully from there, sends and receives.
I would like to get a SPAM folder though. I believe it was talked about in one of the
higher comments and im gonna read that over again and give it a try.
Renan February 26, 2013 at 2:13 pm
I got this error when starting courier-imap-ssl:
missinger IMAP-SSL server: ERROR /usr/bin/couriertls
I got error starting courier-imap also. Something about umask 022, then I correct it
changing the value manually in the script, changing the umask $IMAP_UMASK to
umask 022, then I got another error about limit out of range, and then I change
ulimit -v $IMAP_ULIMITD to ulimit -v 65536, and it works.
Now I have no idea about error generated by courier-imap-ssl. The file /usr/bin
/couriertls is there. Maybe the error is in script
Please, I need help here.
Renan February 26, 2013 at 2:34 pm
I solved the problem commenting those lines in the script courier-imap-ssl:
#if ! [ -x $COURIERTLS ]; then
#log_aciotin_msg $PROGRAM: ERROR $COURIERTLS missing
#exit 1
#fi
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
38 din 44 10/04/2013 14:49
-
I then I had to change the values of $IMAP_UMASK and $IMAP_LIMIT manually
also.
It works now.
But why the script has this erros?
Daniel T February 26, 2013 at 2:55 pm
Hi Adam!
Thanks a lot for this wonderful tutorial! I get everything working as intended, but I still
have one problem left
I cant see a Sent Folder in my mail client Do I have to enable something first, or is it a
preference set by the mail client?
Thanks a lot :)
Adam March 7, 2013 at 11:41 am
Thats usually created by the mail client.
Lennert February 27, 2013 at 4:22 pm
After running the command on the next line i get the following error..Permission
denied..CAN SOMEBODY PLEASE HELP??
/etc/init.d/courier-authdaemon restart
* Stopping Courier authentication services authdaemond /usr/sbin/authdaemond: line
16: /etc/courier/authdaemonrc: Permission denied
[ OK ]
* Starting Courier authentication services authdaemond /usr/sbin/authdaemond: line
16: /etc/courier/authdaemonrc: Permission denied
[ OK ]
Adam March 7, 2013 at 11:42 am
Are you running as root (or sudo)?
Erik W March 3, 2013 at 1:28 am
wow.. I spent forever on this, but in your restart block at the end you need:
/etc/init.d/courier-pop restart
/etc/init.d/courier-pop-ssl restart
or courier pop doesnt pick up the changed certs and fails. FYI
Fernando March 5, 2013 at 4:03 am
I try connect to smtp from remote host but i get:
SASL CRAM-MD5 authentication failed: generic failure
SASL LOGIN authentication failed: generic failure
SASL PLAIN authentication failed: generic failure
How to solve any ideas???
Adam March 7, 2013 at 11:39 am
Take a look at your error log (/var/log/mail.log) for more details should help
identify what hasnt been configured correctly.
rene geul March 7, 2013 at 11:33 am
Creating a Mail Server on Ubuntu (Postfix, Courier, SSL/TLS, SpamAss... http://www.pixelinx.com/2010/10/creating-a-mail-server-on-ubuntu-usin...
39 din 44 10/04/2013 14:49
-
Your aproach for setting up things is the idea that Mysql should be installed.
I have Mysql already installed so :
apt-get install -y mysql-server postfix postfix-mysql libsasl2-modules libsasl2-
modules-sql libgsasl7 libauthen-sasl-cyrus-perl sasl2-bin libpam-mysql clamav-base
libclamav6 clamav-daemon clamav-freshclam amavisd-new spamassassin spamc
courier-base courier-authdaemon courier-authlib-mysql courier-imap courier-imap-ssl
courier-pop courier-pop-ssl courier-ssl
It might work when the computer will not install things that are already installed.
On the other hand I could type in everything execept mysql-server so you get:
apt-get install -y postfix postfix-mysql libsasl2-modules libsasl2-modules-sql libgsasl7
libauthen-sasl-cyrus-perl sasl2-bin libpam-mysql clamav-base libclamav6 clamav-daemon
clamav-freshclam amavisd-new spamassassin spamc courier-base courier-authdaemon
courier-authlib-mysql courier-imap courier-imap-ssl courier-pop courier-pop-ssl
courier-ssl
What is the best to do?
Adam March 7, 2013 at 11:36 am
Either will work the apt-get tool will simply ignore packages which are already
installed (unless the reinstall option is provided).
Kevin Holland March 9, 2013 at 3:51 am
I followe