linux:mailconfigwithpostfix
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:mailconfigwithpostfix [2014/05/22 10:54] – [test receiving mail] admin | linux:mailconfigwithpostfix [2022/10/29 16:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | refer: http:// | ||
| + | email architecture: | ||
| + | http:// | ||
| + | http:// | ||
| + | {{: | ||
| + | ====== Mailserver config ====== | ||
| + | ===== install and config postfix for sending and receiving mail ===== | ||
| + | ==== install ==== | ||
| + | * install <code bash> | ||
| + | yum remove sendmail | ||
| + | yum install cyrus-sasl.x86_64 | ||
| + | yum install postfix | ||
| + | </ | ||
| + | * set MTA default to postfix< | ||
| + | alternatives --set mta / | ||
| + | </ | ||
| + | ==== config and files ==== | ||
| + | * config files< | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | * log< | ||
| + | / | ||
| + | </ | ||
| + | * check content of config< | ||
| + | postconf | ||
| + | </ | ||
| + | * check configs which change by user(none default)< | ||
| + | postconf -n | ||
| + | </ | ||
| + | ==== Basic config ==== | ||
| + | Basic config for Sending and receiving mail with UNIX system accounts | ||
| + | === What domain name to use in outbound mail === | ||
| + | Edit / | ||
| + | <code bash> | ||
| + | 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, | ||
| + | To **secure the mailserver was can't be used by other server**, you can config inet_interfaces to localhost:< | ||
| + | inet_interfaces = localhost | ||
| + | </ | ||
| + | === what domains this machine will deliver locally === | ||
| + | The **mydestination** parameter specifies what domains this machine will deliver locally, instead of forwarding to another machine. | ||
| + | |||
| + | Edit / | ||
| + | <code bash> | ||
| + | mydestination = $myhostname, | ||
| + | </ | ||
| + | ==== Active config in postfix ==== | ||
| + | <code bash> | ||
| + | serivce postfix restart | ||
| + | chkconfig postfix on | ||
| + | </ | ||
| + | ==== test sending and receiving mail ==== | ||
| + | === setup sendmail program: mailx === | ||
| + | <code bash> | ||
| + | yum install mailx | ||
| + | yum install sendmail | ||
| + | </ | ||
| + | === test sending mail === | ||
| + | <code bash> | ||
| + | mail anh.vochi@gmail.com | ||
| + | Subject: Test | ||
| + | This is a email test | ||
| + | #Ctr+D | ||
| + | </ | ||
| + | === test receiving mail === | ||
| + | Using gmail anh.vochi@gmail.com send to root@babies.vn and sale@babies.vn | ||
| + | * Check receiving mail base on maillog: / | ||
| + | * log for mailto root@babies.vn: | ||
| + | May 22 05:39:52 mail postfix/ | ||
| + | May 22 05:39:52 mail postfix/ | ||
| + | May 22 05:39:53 mail postfix/ | ||
| + | May 22 05:39:53 mail postfix/ | ||
| + | May 22 05:39:53 mail postfix/ | ||
| + | May 22 05:39:53 mail postfix/ | ||
| + | May 22 05:39:53 mail postfix/ | ||
| + | </ | ||
| + | * log for mailto sale@babies.vn: | ||
| + | May 22 05:43:13 mail postfix/ | ||
| + | May 22 05:43:13 mail postfix/ | ||
| + | May 22 05:43:13 mail postfix/ | ||
| + | May 22 05:43:58 mail postfix/ | ||
| + | May 22 05:43:59 mail postfix/ | ||
| + | May 22 05:43:59 mail postfix/ | ||
| + | </ | ||
| + | * check mail content received in " | ||
| + | cat / | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | ==== config user anh.vochi@gmail.com can send mail to sale@babies.vn, | ||
| + | Default , we can send mail to root@babies.vn. But we can't send mail to sale@babies.vn. Below are steps forward emails of sale@babies.vn to sale UNIX system account(sale is UNIX system account) | ||
| + | === config === | ||
| + | [/ | ||
| + | virtual_alias_maps = hash:/ | ||
| + | | ||
| + | [/ | ||
| + | sale@babies.vn sale, anh.vochi@gmail.com, | ||
| + | === Active changes in config === | ||
| + | - run scripts below:< | ||
| + | postmap / | ||
| + | #=> generate / | ||
| + | </ | ||
| + | - reload postfix: / | ||
| + | - check config:< | ||
| + | postmap -q sale@babies.vn hash:/ | ||
| + | </ | ||
| + | - Using anh.vochi@gmail.com send mail to sale@babies.vn | ||
| + | ==== Check Mail Server Storage(MSS) for Receiving Email which postfix support ==== | ||
| + | <code bash> | ||
| + | postconf -a | ||
| + | cyrus | ||
| + | dovecot | ||
| + | </ | ||
| + | ===== Install and config Mail Server Storage with cyrus for Mail client connecting ===== | ||
| + | < | ||
| + | | ||
| + | Incoming Mail |--+ | ||
| + | -|---------------- | ||
| + | || | ||
| + | -|---------------- | ||
| + | |+> | ||
| + | |+> | ||
| + | -|--------------|- | ||
| + | ||Authentication|| | ||
| + | |+< | ||
| + | ------------------ | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | ==== Install cyrus ==== | ||
| + | <code bash> | ||
| + | yum install cyrus-imapd.x86_64 | ||
| + | </ | ||
| + | ==== config postfix connect with cyrus via lmtp(local mail transfer protocol) ==== | ||
| + | === config postfix === | ||
| + | <code bash> | ||
| + | postconf -e " | ||
| + | </ | ||
| + | === config cyrus === | ||
| + | [/ | ||
| + | lmtpunix | ||
| + | === active changes in config === | ||
| + | <code bash> | ||
| + | / | ||
| + | / | ||
| + | chkconfig postfix on | ||
| + | chkconfig cyrus-imapd on | ||
| + | </ | ||
| + | ==== Config Cyrus-Imapd for domain and mail client authentication ==== | ||
| + | [/ | ||
| + | < | ||
| + | admins: cyrus cyrusadm | ||
| + | </ | ||
