Centos6.5 配置email服务

这是整个安装过程,我从终端复制过来的,输入的命令可以看以[root@localhost……]开头的,就是输入的操作命令。其中配置文件该做的更改内容,终端无法显示,有需要可以再留言板细化展示。

用户xia01@21ysjxb.com 发邮件给 xia02@21yjsxb.com,登录xia02查看邮件。效果
图片

图片

[root@localhost yum.repos.d]# yum install -y sendmail-cf
[root@localhost yum.repos.d]# yum install -y sendmail
[root@localhost yum.repos.d]# yum install -y m4
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Package m4-1.4.13-5.el6.x86_64 already installed and latest version
Nothing to do
[root@localhost yum.repos.d]# yum install -y docecot
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
No package docecot available.
Error: Nothing to do
[root@localhost yum.repos.d]# yum install -y dovecot
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dovecot.x86_64 1:2.0.9-7.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch          Version                 Repository           Size
================================================================================
Installing:
 dovecot        x86_64        1:2.0.9-7.el6           local_server        1.9 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 1.9 M
Installed size: 5.7 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing :1:dovecot-2.0.9-7.el6.x86_64                                 1/1
  Verifying  : 1:dovecot-2.0.9-7.el6.x86_64                                 1/1

Installed:
  dovecot.x86_64 1:2.0.9-7.el6                                                  

Complete!
[root@localhost yum.repos.d]# yum install -y dovecot-mysql
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dovecot-mysql.x86_64 1:2.0.9-7.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch         Version              Repository          Size
================================================================================
Installing:
 dovecot-mysql       x86_64       1:2.0.9-7.el6        local_server        38 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 38 k
Installed size: 18 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing :1:dovecot-mysql-2.0.9-7.el6.x86_64                           1/1
  Verifying  : 1:dovecot-mysql-2.0.9-7.el6.x86_64                           1/1

Installed:
  dovecot-mysql.x86_64 1:2.0.9-7.el6                                           

Complete!
[root@localhost yum.repos.d]# yum install -y dovecot-pgsql
Loaded plugins: fastestmirror, refresh-packagekit, security
Existing lock /var/run/yum.pid: another copy is running as pid 3295.
Another app is currently holding the yum lock; waiting for it to exit…
  The other application is:PackageKit
    Memory :  31 M RSS (339 MB VSZ)
    Started: Thu May 12 14:27:50 2022 -00:04 ago
    State : Sleeping, pid: 3295
Existing lock /var/run/yum.pid: another copy is running as pid 3297.
Another app is currently holding the yum lock; waiting for it to exit…
  The other application is:PackageKit
    Memory :  24 M RSS (331 MB VSZ)
    Started: Thu May 12 14:27:56 2022 -00:00 ago
    State : Running, pid: 3297
Another app is currently holding the yum lock; waiting for it to exit…
  The other application is:PackageKit
    Memory :  31 M RSS (339 MB VSZ)
    Started: Thu May 12 14:27:56 2022 -00:02 ago
    State : Sleeping, pid: 3297
Another app is currently holding the yum lock; waiting for it to exit…
  The other application is:PackageKit
    Memory :  31 M RSS (339 MB VSZ)
    Started: Thu May 12 14:27:56 2022 -00:04 ago
    State : Sleeping, pid: 3297
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dovecot-pgsql.x86_64 1:2.0.9-7.el6 will be installed
–> Processing Dependency: libpq.so.5()(64bit) for package:1:dovecot-pgsql-2.0.9-7.el6.x86_64
–> Running transaction check
—> Package postgresql-libs.x86_64 0:8.4.18-1.el6_4 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch        Version               Repository         Size
================================================================================
Installing:
 dovecot-pgsql        x86_64      1:2.0.9-7.el6         local_server       41 k
Installing for dependencies:
 postgresql-libs      x86_64      8.4.18-1.el6_4        local_server      201 k

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 241 k
Installed size: 650 k
Downloading Packages:
——————————————————————————–
Total                                           11 MB/s | 241 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : postgresql-libs-8.4.18-1.el6_4.x86_64                        1/2
  Installing :1:dovecot-pgsql-2.0.9-7.el6.x86_64                           2/2
  Verifying  : 1:dovecot-pgsql-2.0.9-7.el6.x86_64                           1/2
  Verifying  : postgresql-libs-8.4.18-1.el6_4.x86_64                        2/2

Installed:
  dovecot-pgsql.x86_64 1:2.0.9-7.el6                                           

Dependency Installed:
  postgresql-libs.x86_640:8.4.18-1.el6_4                                      

Complete!
[root@localhost yum.repos.d]# yum install -y dovecot-pigeonhole
Loaded plugins: fastestmirror, refresh-packagekit, security
Existing lock /var/run/yum.pid: another copy is running as pid 3299.
Another app is currently holding the yum lock; waiting for it to exit…
  The other application is:PackageKit
    Memory :  31 M RSS (339 MB VSZ)
    Started: Thu May 12 14:28:12 2022 -00:03 ago
    State : Sleeping, pid: 3299
Another app is currently holding the yum lock; waiting for it to exit…
  The other application is: PackageKit
    Memory :  31 M RSS (339 MB VSZ)
    Started: Thu May 12 14:28:12 2022 -00:05 ago
    State : Sleeping, pid: 3299
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dovecot-pigeonhole.x86_64 1:2.0.9-7.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch        Version            Repository         Size
================================================================================
Installing:
 dovecot-pigeonhole      x86_64      1:2.0.9-7.el6      local_server       98 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 98 k
Installed size: 222 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing :1:dovecot-pigeonhole-2.0.9-7.el6.x86_64                      1/1
  Verifying  :1:dovecot-pigeonhole-2.0.9-7.el6.x86_64                      1/1

Installed:
  dovecot-pigeonhole.x86_641:2.0.9-7.el6                                      

Complete!
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# chkconfig –levle 2345 postfix off
–levle: 未知的选项
[root@localhost yum.repos.d]# chkconfig –level 2345 postfix off
[root@localhost yum.repos.d]# chkconfig –level 2345 named on
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ls
bak242  local.repo
[root@localhost yum.repos.d]# vim /var/named/21yjsxb.zone
[root@localhost yum.repos.d]# nslookup -q=mx 21yjsxb.com
Server:     192.168.242.100
Address:    192.168.242.100#53

21yjsxb.com mail exchanger = 5mail.21yjsxb.com.

[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# useradd xia01
[root@localhost yum.repos.d]# passwd xia01
更改用户 xia01 的密码 。
新的 密码:
无效的密码: 过于简单化/系统化
无效的密码: 过于简单
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# useradd xia02
[root@localhost yum.repos.d]# passwd xia02
更改用户 xia02 的密码 。
新的 密码:
无效的密码: 过于简单化/系统化
无效的密码: 过于简单
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# cd /home
[root@localhost home]# ls
VMwareTools-10.2.5-8068393.tar.gz
vmware-tools-distrib
xb242
xia01
xia02
[root@localhost home]# mkdir -p /home/xia01/mail/.imap/INBOX
[root@localhost home]# mkdir -p /home/xia02/mail/.imap/INBOX
[root@localhost home]#
[root@localhost home]# cd xia01
[root@localhost xia01]# ls
mail
[root@localhost xia01]# ll
总用量 4
drwxr-xr-x 3 root root 4096 5月  12 14:32 mail
[root@localhost xia01]# cd ..
[root@localhost home]# ls
~$6月24日赣州职业技术学院发热人员或疑似症状人员汇总台账.xlsx.id[5728D183-2700].[yourbackup@email.tg].Devos
VMwareTools-10.2.5-8068393.tar.gz
vmware-tools-distrib
xb242
xia01
xia02
[root@localhost home]# chmod -R 777 xia01
[root@localhost home]# chmod -R 777 xia02
[root@localhost home]# ls
~$6月24日赣州职业技术学院发热人员或疑似症状人员汇总台账.xlsx.id[5728D183-2700].[yourbackup@email.tg].Devos
VMwareTools-10.2.5-8068393.tar.gz
vmware-tools-distrib
xb242
xia01
xia02
[root@localhost home]# vim /etc/aliases
[root@localhost home]# vim /etc/aliases
[root@localhost home]# newaliases
/etc/aliases: 78 aliases, longest 10 bytes, 785 bytes total
[root@localhost home]# vi /etc/mail/sendmail.mc
[root@localhost home]# vi /etc/mail/sendmail.mc
[root@localhost home]# vi /etc/mail/sendmail.mc
[root@localhost home]#
[root@localhost home]#
[root@localhost home]# m4 /etc/mail/sendmail.mc > /etc/mail
mail/    mailcap  mail.rc 
[root@localhost home]# m4 /etc/mail/sendmail.mc >/etc/mail/sendmail.cf
[root@localhost home]# vim /etc/mail/access
[root@localhost home]# makemap -r hash /etc/mail/access.db </etc/mail/access
[root@localhost home]#
[root@localhost home]#
[root@localhost home]# m4 /etc/mail/sendmail.mc >/etc/mail/sendmail.cf
[root@localhost home]# vi /etc/dovecot/dovecot.conf
[root@localhost home]# vi /etc/dovecot/dovecot.conf
[root@localhost home]# vi /etc/dovecot/conf.d/10-auth.conf
[root@localhost home]# vi /etc/dovecot/conf.d/10-ssl.conf
[root@localhost home]# vi /etc/dovecot/conf.d/10-mail.conf
[root@localhost home]#
[root@localhost home]#
[root@localhost home]# service sendmail restart
关闭 sendmail:                                            [失败]
正在启动 sendmail:                                        [确定]
启动 sm-client:                                           [确定]
[root@localhost home]# telnet localhost 25
bash: telnet: command not found
[root@localhost home]#
[root@localhost home]# yum install -y telnet
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package telnet.x86_64 1:0.17-47.el6_3.1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch          Version                  Repository           Size
================================================================================
Installing:
 telnet        x86_64        1:0.17-47.el6_3.1        local_server         58 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 58 k
Installed size: 109 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing :1:telnet-0.17-47.el6_3.1.x86_64                              1/1
  Verifying  : 1:telnet-0.17-47.el6_3.1.x86_64                              1/1

Installed:
  telnet.x86_64 1:0.17-47.el6_3.1                                               

Complete!
[root@localhost home]#
[root@localhost home]# telnet localhost 25
Trying ::1…
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4; Thu, 12 May 202214:45:55 +0800
help
214-2.0.0 This is sendmail
214-2.0.0 Topics:
214-2.0.0   HELO    EHLO    MAIL    RCPT    DATA
214-2.0.0   RSET    NOOP    QUIT    HELP    VRFY
214-2.0.0   EXPN    VERB    ETRN    DSN AUTH
214-2.0.0   STARTTLS
214-2.0.0 For more info use “HELP <topic>”.
214-2.0.0 To report bugs in the implementation see
214-2.0.0   http://www.sendmail.org/email-addresses.html
214-2.0.0 For local information send email to Postmaster at your site.
214 2.0.0 End of HELP info
quit
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.
[root@localhost home]# service dovecot start
正在启动 Dovecot Imap:                                    [确定]
[root@localhost home]# netstat -antulp | grep :110
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      3468/dovecot       
tcp        0      0 :::110                      :::*                        LISTEN      3468/dovecot       
[root@localhost home]#
[root@localhost home]#
[root@localhost home]# telnet localhost 110
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
+OK Dovecot ready.
quit
+OK Logging out
Connection closed by foreign host.
[root@localhost home]# telnet mail.21yjsxb.com 25
telnet: mail.21yjsxb.com: Name or service not known
mail.21yjsxb.com: Unknown host
[root@localhost home]# ping mail.21yjsxb.com
^C
[root@localhost home]# service named reload
重新载入named:                                             [确定]
[root@localhost home]# service named restart
停止 named:.                                              [确定]
启动 named:                                              [确定]
[root@localhost home]# telnet mail.21yjsxb.com 25
Trying 192.168.242.100…
Connected to mail.21yjsxb.com.
Escape character is ‘^]’.
220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4; Thu, 12 May 202214:49:01 +0800
help
214-2.0.0 This is sendmail
214-2.0.0 Topics:
214-2.0.0   HELO    EHLO    MAIL    RCPT    DATA
214-2.0.0   RSET    NOOP    QUIT    HELP    VRFY
214-2.0.0   EXPN    VERB    ETRN    DSN AUTH
214-2.0.0   STARTTLS
214-2.0.0 For more info use “HELP <topic>”.
214-2.0.0 To report bugs in the implementation see
214-2.0.0   http://www.sendmail.org/email-addresses.html
214-2.0.0 For local information send email to Postmaster at your site.
214 2.0.0 End of HELP info
mail from:xia01@^[^C
quit
Connection closed by foreign host.
[root@localhost home]# ping 21yjsxb.com
^C
[root@localhost home]# ping xia01@21yjsxb.com
^C
[root@localhost home]# vi /var/named/21yjsxb.zone
[root@localhost home]# service named reload
重新载入named:                                             [确定]
[root@localhost home]# service named restart
停止 named:.                                              [确定]
启动 named:                                              [确定]
[root@localhost home]# ping 21yjsxb.com
PING 21yjsxb.com (192.168.242.100) 56(84) bytes of data.
64 bytes from dns.21yjsxb.com (192.168.242.100): icmp_seq=1 ttl=64 time=0.046ms
64 bytes from dns.21yjsxb.com (192.168.242.100): icmp_seq=2 ttl=64 time=0.066ms
64 bytes from dns.21yjsxb.com (192.168.242.100): icmp_seq=3 ttl=64 time=0.674ms
64 bytes from dns.21yjsxb.com (192.168.242.100): icmp_seq=4 ttl=64 time=0.068ms
^C
— 21yjsxb.com ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3481ms
rtt min/avg/max/mdev = 0.046/0.213/0.674/0.266 ms
[root@localhost home]# ping xia01@21yjsxb.com
^C
[root@localhost home]# telnet mail.21yjsxb.com 25
Trying 192.168.242.100…
Connected to mail.21yjsxb.com.
Escape character is ‘^]’.
220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4; Thu, 12 May 202214:52:11 +0800
help
214-2.0.0 This is sendmail
214-2.0.0 Topics:
214-2.0.0   HELO    EHLO    MAIL    RCPT    DATA
214-2.0.0   RSET    NOOP    QUIT    HELP    VRFY
214-2.0.0   EXPN    VERB    ETRN    DSN AUTH
214-2.0.0   STARTTLS
214-2.0.0 For more info use “HELP <topic>”.
214-2.0.0 To report bugs in the implementation see
214-2.0.0   http://www.sendmail.org/email-addresses.html
214-2.0.0 For local information send email to Postmaster at your site.
214 2.0.0 End of HELP info

500 5.5.1 Command unrecognized: “”
mail from:xia01@21yjsxb.com
250 2.1.0 xia01@21yjsxb.com… Sender ok
rcpt to:xia02@21yjsxb.com
250 2.1.5 xia02@21yjsxb.com… Recipient ok
data
354 Enter mail, end with “.” on a line by itself
nihao woshi xia01.
.
250 2.0.0 24C6qBgm003578 Message accepted for delivery
data
503 5.0.0 Need MAIL command
subject:test message
500 5.5.1 Command unrecognized: “subject:test message”
data
503 5.0.0 Need MAIL command
quit
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.
[root@localhost home]# telnet mail.21yjsxb.com 110
Trying 192.168.242.100…
Connected to mail.21yjsxb.com.
Escape character is ‘^]’.
+OK Dovecot ready.
user xia02
+OK
pass 123456
+OK Logged in.
list
+OK 1 messages:
1 490
.
retr 1
+OK 490 octets
Return-Path: <xia01@21yjsxb.com>
Received: from dns.21yjsxb.com (dns.21yjsxb.com [192.168.242.100])
    by localhost.localdomain(8.14.4/8.14.4) with SMTP id 24C6qBgm003578
    for xia02@21yjsxb.com; Thu, 12 May2022 14:52:51 +0800
Date: Thu, 12 May 2022 14:52:11 +0800
From: xia01@21yjsxb.com
Message-Id: <202205120652.24C6qBgm003578@localhost.localdomain>
X-Authentication-Warning: localhost.localdomain: dns.21yjsxb.com[192.168.242.100] didn’t use HELO protocol

nihao woshi xia01.
.
到此,查看完毕,基本步骤如上所示。

类别:

没有回应

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

近期评论
您尚未收到任何评论。

分类

赣公网安备36080202000527号 赣ICP备2026018746