Linux server mail configuration

Source: Internet
Author: User
Tags imap dovecot nslookup squirrelmail

Linux server mail configuration postfix (MTA smtp) + dovecot (pop3/imap) + squirrelmail (webmail) + apache + php + bind 1. Set the host name [root @ www ~] # Vim/etc/sysconfig/network [root @ www ~] # Hostname mail.baidu.com [root @ www ~] # Vim/etc/hosts192.168.0.1 www.baidu.com www baidu.com 2. Configure DNS [root @ www ~] # Yum-y remove bind [root @ www ~] # Yum-y install bind [root @ mail ~] # Vim/etc/named. conf listen-on port 53 {127.0.0.1; any ;}; allow-query {localhost; any ;}; [root @ mail ~] # Vim/etc/named. rfc1912.zoneszone "baidu.com" IN {type master; file "baidu.com. zone"; allow-update {none ;}; [root @ mail ~] # Named-checkconf/etc/named. conf [root @ mail ~] # Cd/var/named/[root @ mail named] # cp named. localhost baidu.com. zone-a [root @ mail named] # vim baidu.com. zone $ TTL 1D @ in soa dns1.baidu.com. root.baidu.com. (0; serial 1D; refresh 1 H; retry 1 W; expire 3 H); minimum @ NS dns1.baidu.com. dns1 A 192.168.0.1www A 192.168.0.100 @ MX 5 mail.baidu.com. mail A 192.168.0.1pop A 192.168.0.1imap A 192.168.0.1 [root @ mail named] # named-checkzone baidu.com/ Var/named/baidu.com. zone baidu.com/IN: loaded serial 0OK [root @ mail named] # service named startStarting named: [OK] [root @ mail named] # chkconfig named on [root @ mail named] # nslookup> serverDefault server: 192.168.0.17Address: 192.168.0.17 #53> exit [root @ mail named] # vim/etc/resolv. conf nameserver 192.168.0.1 [root @ mail named] # nslookup> serverDefault server: 192.168.0.1Address: 192.168.0.1 #53> set type = ns> baidu. comServer: 192.168.0.1Address: 192.168.0.1 #53 baidu.com nameserver = dns1.baidu.com.> set type = mx> baidu. comServer: 192.168.0.1Address: 192.168.0.1 #53 baidu.com mail exchanger = 5 mail.baidu.com. ++ ++ 3. configure postfix [root @ mail ~] # Rpm-qa | grep postfixpostfix-2.6.6-2.el6.x86_64 75 myhostname = 12783 mydomain = baidu.com 99 myorigin = $ mydomain116 inet_interfaces = all119 inet_protocols = %4164 mydestination = $ myhostname, $ mydomain, localhost264 mynetworks = 192.168.0.0/24419 home_mailbox = Maildir/[root @ mail ~] # Service postfix restartShutting down postfix: [FAILED] Starting postfix: [FAILED] [root @ mail ~] # Postfix stoppostfix/postfix-script: stopping the Postfix mail system [root @ mail ~] # Postfix startpostfix/postfix-script: starting the Postfix mail system [root @ mail ~] # Netstat-tnlp | grep: 25tcp 0 0.0.0.0: 25 0.0.0.0: * LISTEN 8731/master 4. Use dovecot to receive 110/143 messages # yum-y install dovecot [root @ mail ~] #/Etc/init. d/dovecot start is starting Dovecot Imap: [OK] [root @ mail ~] # Chkconfig dovecot ontcp 0 0.0.0.0: 110 0.0.0.0: * LISTEN 8789/dovecot tcp 0 0.0.0.0: 143 0.0.0.0: * LISTEN 8789/dovecot tcp 0 0 0.0.0.0: 993 0.0.0.0: * LISTEN 8789/dovecot tcp 0 0.0.0.0: 995 0.0.0.0: * LISTEN 8789/dovecot tcp 0 ::: 110 ::* LISTEN 8789/dovecot tcp 0 ::: 143: * LISTEN 8789/dovecot tcp 0: 993: * LISTEN 8789/dovecot tcp 0: 995 ::: * LISTEN 8789/dovecot test: whether to send and receive emails to [roo T @ mail ~] # Telnet localhost 25 Trying: 1... telnet: connect to address: 1: Connection refusedTrying 127.0.0.1... connected to localhost. escape character is '^]'. 220 mail.baidu.com ESMTP Postfixehlo localhost250-mail.baidu.com250-PIPELINING250-SIZE mongodsnmail from: root@baidu.com250 2.1.0 Okrcpt to: a@baidu.com250 2.1.5 Okdata354 End data with <CR> <LF>. <CR> <LF> subject: a test mail hi a .. 250 2.0.0 OK: queued as 12C1B2E0002quit221 2.0.0 ByeConnection closed by foreign host. Receive the email [root @ mail ~] # Telnet localhost 110 Trying: 1... connected to localhost. escape character is '^]'. + OK Dovecot ready. <2310.1.50eb9602.Wwof2gVP8FFYVTmyZ5vj7A ==@ mail.baidu.com> user a + OKpass 1 + OK Logged in. list + OK 1 messages: 1 436. retr 1 can I send and receive emails through ssh 192.168.0.17 if I log on to another PC? [root @ login top17 ~] # Yum-y install telnet [root @ dns1 ~] # Telnet 192.168.0.1Trying 192.168.0.1... telnet: connect to address 192.168.0.1: Connection refused [root @ dns1 ~] # Telnet 192.168.0.1 25 Trying 192.168.0.1... connected to 192.168.0.1.Escape character is '^]'. 220 mail.baidu.com ESMTP Postfixehlo localhost250-mail.baidu.com250-PIPELINING250-SIZE mongodsnmail from: test2@baidu.com250 2.1.0 Okrcpt to: a@baidu.com250 2.1.5 Okdata354 End data with <CR> <LF>. <CR> <LF> subject: a test mail telnethi .. 250 2.0.0 OK: q Ueued as B2AEA2E0002quit221 2.0.0 ByeConnection closed by foreign host. [root @ dns1 ~] # Telnet 192.168.0.1 110 Trying 192.168.0.1... connected to 192.168.0.1.Escape character is '^]'. + OK Dovecot ready. <2365.1.50eb9703.T8b8hHgcZ5ZFExiwEfiz8w ==@ mail.baidu.com> user a-ERR Plaintext authentication disallowed on non-secure (SSL/TLS) connections. pop3 plaintext login [root @ mail ~] is not allowed # Vim/etc/dovecot/conf. d/10-auth.conf 9 disable_plaintext_auth = no [root @ www ~] # Service dovecot reload [root @ dns1 ~] # Telnet 192.168.0.1 110 Trying 192.168.0.1... connected to 192.168.0.1.Escape character is '^]'. + OK Dovecot ready. <2437.1.50eb9825.5Ls9iuJ + nWBnJ9 + cIwCTLA ==@ mail.baidu.com> user a + OKpass 1 + OK Logged in. list + OK 2 messages: 1 4362 286. retr-ERR There's no message 0. retr-ERR There's no message 0. retr 2 + OK 286 octetsReturn-Path: <test2@baidu.com> X-Original-To: a@baidu.comDelivered-To: a@baidu.comReceived: from localhost (s17 [192.168.0.17]) by mail.baidu.com (Postfix) with ESMTP id B2AEA2E0002for <a@baidu.com>; Tue, 8 Jan 2013 11:47:48 + 0800 (CST) subject: a test mail telnet hi .. 5. configure the WEB Client # yum-y remove httpd # yum-y install httpd php # vim/etc/httpd/conf/httpd. confServerName mail.baidu.com # service httpd start # chkconfig httpd on creates an httpd VM # vim/etc/httpd/conf/httpd. conf <Directory/mail> Options Indexes AllowOverride None Order allow, deny Allow from 192.168.0.0/24 </Directory> NameVirtualHost *: 80 <VirtualHost *: 80> ServerAdmin root@baidu.com DocumentRoot/mail ServerName mail.baidu.com ErrorLog logs/mail.baidu.com-error_log CustomLog logs/your-access_log common </VirtualHost> # mkdir/mail # yum-y install php # service httpd # chkconfig httpd on --------------------------------- create a web, support sending and receiving mail via web page # scp zh_CN-1.4.13-20071220.tar.bz2 squirrelmail-1.4.13.tar.bz2 root@192.168.0.16: /root # tar xf squirrelmail-1.4.13.tar.bz2 # mv/root/squirrelmail-1.4.13/*/mail/Pack Chinese # mkdir/root/zh # tar xf zh_CN-1.4.13-20071220.tar.bz2-C/root/zhcd/root/zh #. /install Please enter path to your squirrelmail installation:/mail to create the configuration file: # cd/mail/config # cp config_default.php config. php # vim/mail/config. php 118 $ domain = 'Baidu. com '; 1000 $ squirrelmail_default_language = 'zh _ cn'; 1015 $ default_charset = 'zh _ CN.UTF-8'; 487 $ data_dir = '/mail/data /'; -- email data 505 $ attachment_dir = '/mail/attach/'; -- email attachment # mkdir/mail/{data, attach}-p # chown-R apache. apache/mail/data // mail/attach/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.