linux邮件服务器配置
1.邮件系统角色
MUA:mail user agent(foxmail,outlook) 写信的软件
MTA:qq,163<server>(postfix) 转递
MDA:contained by MTA 本地投递
MTA和MDA由同一个软件实现
2,邮件应用协议
smtp:25 传输
pop3:110 收邮件
imap4:143 通过网页的形式收邮件
3.商业邮件系统
exchange:Windows 微软
Notes/Domino IBM 价格高
4.开源邮件系统
Sendmail:unix 最古老的,配置很复杂
Qmail 效率很高
Postfix:linux(iReadMail:抵抗垃圾软件) 现在用的比较多
5./etc/postfix/main.cf
myorigin:外发邮件时指定发件人的域名
mydestination:postfix本地接收的邮件域名
mynetwork:服务器为哪些网段的客户机转发邮件
inet_interfaces:服务器监听的ip地址
home_mailbox:邮件的存储方式(mailbox:/var /spool/mail/username, maildir:/home/username/mail)
6.日志
/var/log/maillog
7.telnet
[root@www postfix]# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is ‘^]‘.
220 mail.ds4.com ESMTP Postfix
helo mail.sohu.com
250 mail.ds4.com
mail from: [email protected]
250 2.1.0 Ok
rcpt to:[email protected]
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
subect:titie1
abva
653
.
8.mail 本机(服务器)发邮件
echo "123 456"|mail -s "title3" [email protected]
[sky@www ~]$ vim file
[sky@www ~]$ mail -s "title4" [email protected] < file
查看邮件
su - username
mail
9.pop3:dovecot(linux),foxmail(windows) 收邮件
[root@www dovecot]# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is ‘^]‘.
+OK Dovecot ready.
user sky
+OK
pass aixocm
+OK Logged in.
list
+OK 1 messages:
1 490
.
retr 1
+OK 490 octets
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: by mail.ds4.com (Postfix, from userid 502)
id 54A221140810; Sat, 4 Jan 2014 11:04:01 +0800 (CST)
Date: Sat, 04 Jan 2014 11:04:01 +0800
To: [email protected]
Subject: title5
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <[email protected]>
From: [email protected]
werw454 //邮件内容
.
10.步骤
yum install -y postfix
service postfix restart
netstat -antulp|grep ":25"
ps aux|grep -i "postfix"
cd /etc/postfix
vim main.cf
mydomain=ds4.com
myhostname=mail.ds4.com
mydestination=$mydomain,$myhostname,localhost,localhost.localdomain
myorigin=$mydomain
inet_interface=all
home_mailbox=Maildir/
yum install -u dovecot
cd /etc/dovecot
vim dovecot.conf
protocols=imap pop3
disable_plaintext_auth=no
service dovecot restart
netstat -antulp|grep ":110"
telnet 10.0.5.7 25 //postfix
helo mail.yahoo.com
mail from: [email protected]
rcpt to: [email protected]
data
subject: title10
abc
.
telnet 10.0.5.7 110 //dovecot
user tom
pass aixocm
list
retr 1
cd /home/tom/Maildir //服务器
new cur //未读信件在new中,已读信件在cur中
mailq
postfix flush
postsuper -d AAF23E0556
11.用imap4协议收邮件 //网页形式
yum install httpd php -y
service httpd start
tar xvf squirrelmail.tar.gz -C /var/www/html
mv squirrelmail mail
cd /var/www/html/mail
mkdir attach
chown -R apache.apache attach data
cd config
cp config_default.php config.php
vim config.php
$default_charset = ‘zh_CN.UTF-8‘;
$domain = ‘ds2.com‘;
$imap_server_type = ‘dovecot‘;
data_dir = ‘/var/www/html/mail/data‘;
$attachment_dir = ‘/var/www/html/mail/attach‘;
http://10.0.5.7/mail
12.认证
vim /usr/lib/sasl/smtpd.conf
pwcheck_method: saslauthd
vim /etc/sysconfig/saslauthds
MECH=shadow
service saslauthd start
vim /etc/postfix/main.cf
mynetworks = 127.0.0.1
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,check_relay_domains
smtpd_client_restrictions = permit_sasl_authenticated
service postfix restart
本文出自 “8438262” 博客,请务必保留此出处http://8448262.blog.51cto.com/8438262/1398716
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。