refer: http://tecadmin.net/install-and-configure-postfix-on-centos-redhat/
email architecture: email system in linux
http://www.postfix.org/documentation.html
http://postfix.state-of-mind.de/patrick.koetter/smtpauth/sasldb_configuration.html
postfix slide show
yum remove sendmail yum install cyrus-sasl.x86_64 yum install postfix
alternatives --set mta /usr/sbin/postfix
/etc/sasl2/smtpd.conf /etc/postfix/main.cf
/var/log/maillog
postconf
postconf -n
Basic config for Sending and receiving mail with UNIX system accounts
Edit /etc/postfix/main.cf:
myhostname = mail.babies.vn
mydomain = babies.vn
myorigin = $mydomain
inet_interfaces = all
The myorigin parameter specifies the domain that appears in mail that is posted on this machine. Follow this configuration, send mail as “user@$mydomain”
To secure the mailserver was can't be used by other server, you can config inet_interfaces to localhost:
inet_interfaces = localhost
The mydestination parameter specifies what domains this machine will deliver locally, instead of forwarding to another machine.
Edit /etc/postfix/main.cf:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
serivce postfix restart chkconfig postfix on
yum install mailx yum install sendmail
mail anh.vochi@gmail.com Subject: Test This is a email test #Ctr+D
Using gmail [email protected] send to [email protected] and [email protected]
May 22 05:39:52 mail postfix/smtpd[4228]: connect from mail-qg0-f43.google.com[209.85.192.43] May 22 05:39:52 mail postfix/smtpd[4228]: C968340900: client=mail-qg0-f43.google.com[209.85.192.43] May 22 05:39:53 mail postfix/cleanup[4232]: C968340900: message-id=<CADwQOAhT-WZ2wBRmXx0eDsJvTK5FtqauqryDDPgDCA7PYed3tw@mail.gmail.com> May 22 05:39:53 mail postfix/qmgr[4141]: C968340900: from=<[email protected]>, size=2268, nrcpt=1 (queue active) May 22 05:39:53 mail postfix/local[4233]: C968340900: to=<[email protected]>, relay=local, delay=0.74, delays=0.71/0.02/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox) May 22 05:39:53 mail postfix/qmgr[4141]: C968340900: removed May 22 05:39:53 mail postfix/smtpd[4228]: disconnect from mail-qg0-f43.google.com[209.85.192.43]
May 22 05:43:13 mail postfix/anvil[4230]: statistics: max connection rate 1/60s for (smtp:209.85.192.43) at May 22 05:39:52 May 22 05:43:13 mail postfix/anvil[4230]: statistics: max connection count 1 for (smtp:209.85.192.43) at May 22 05:39:52 May 22 05:43:13 mail postfix/anvil[4230]: statistics: max cache size 1 at May 22 05:39:52 May 22 05:43:58 mail postfix/smtpd[4247]: connect from mail-qc0-f179.google.com[209.85.216.179] May 22 05:43:59 mail postfix/smtpd[4247]: NOQUEUE: reject: RCPT from mail-qc0-f179.google.com[209.85.216.179]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-qc0-f179.google.com> May 22 05:43:59 mail postfix/smtpd[4247]: disconnect from mail-qc0-f179.google.com[209.85.216.179]
cat /var/mail/root
Or
Default , we can send mail to [email protected]. But we can't send mail to [email protected]. Below are steps forward emails of [email protected] to sale UNIX system account(sale is UNIX system account)
[/etc/postfix/main.cf]
virtual_alias_maps = hash:/etc/postfix/virtual
[/etc/postfix/virtual]
[email protected] sale, [email protected], [email protected], [email protected]
postmap /etc/postfix/virtual #=> generate /etc/postfix/virtual.db
postmap -q sale@babies.vn hash:/etc/postfix/virtual
postconf -a
cyrus
dovecot
------------------ Incoming Mail |--+ Postfix <-----------| Outgoing Mail | -|---------------- | || LMTP | | -|---------------- | |+> Cyrus +----------------+ | |+> Imapd ||---->+ | | -|--------------|- | | | ||Authentication|| 2| 1| | |+< SASL <+| v ^ | ------------------ |Receiving| |Sending| | | +--------------------+ | Mail Client |
yum install cyrus-imapd.x86_64
postconf -e "mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp"
[/etc/cyrus.conf]
lmtpunix cmd="lmtpd" listen="/var/lib/imap/socket/lmtp" prefork=1
/etc/init.d/postfix restart /etc/init.d/cyrus-imapd restart chkconfig postfix on chkconfig cyrus-imapd on
[/etc/imapd.conf]
admins: cyrus cyrusadm