Configure the exim sending server in CentOS 6 and 7
1. Configure the epel source (the exim package is located in the EPEL software source)
CentOS7
#cat>/etc/yum.repos.d/epel.repo<<EOF
[epel]
name
=
ExtraPackages
for
EnterpriseLinux
7
-
\$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch
mirrorlist
=
https:
/
/
mirrors.fedoraproject.org
/
metalink?repo
=
epel
-
7
&arch
=
\$basearch
failovermethod
=
priority
enabled
=
1
gpgcheck
=
0
EOF
CentOS6
#cat>/etc/yum.repos.d/epel.repo<<EOF
[epel]
name
=
ExtraPackages
for
EnterpriseLinux
6
-
\$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
mirrorlist
=
https:
/
/
mirrors.fedoraproject.org
/
metalink?repo
=
epel
-
6
&arch
=
\$basearch
failovermethod
=
priority
enabled
=
1
gpgcheck
=
0
EOF
2. Disable postfix
# Servicepostfixstop
# Chkconfigpostfixoff
3. Install exim
# Yum-yinstallexim
4. Set exim as the default MTA
# Alternatives -- setmta/usr/sbin/sendmail. exim
5. Modify the exim configuration file
# Vi/etc/exim. conf # several parameters
primary_hostname
=
mail.flying.com
# When viewing the source email, the message "Received ed: frommail.flying.com" is displayed. If you do not specify the Host Name of the operating system
domainlistlocal_domains
=
@localhost:localhost.localdomain:mail.flying.com
domainlistrelay_to_domains
=
flying.com
# Domain name that allows email sending by host Modification
hostlistrelay_from_hosts
=
127.0
.
0.1
:
192_32G
:
10.168
.
0.0
/
16
:
<br>
# Allow the client hosts to send emails. If you use this server to send emails locally, you need to add a local egress IP address (public network address)
6. Test
# Yum-yinstallmailx
# Date | mail-rno-reply@flying.com-s 'eximtest' uttflying @ foxmail.com
# Tail-f/var/log/exim/main. log # exim log File
Ps:
If-r is not specified and your host name is not xxx.com, the following error may be reported:
SMTP error from remote mail server after mail from:
The error is 550 MI: the IMF sender's email address is invalid.
Use files to send Emails:
date|mail
-
rflying@yflying.com
-
s
'SN_IPinfoTEXT'
uttflying@
163.com
wanglei@flying.com<
/
root
/
cobbler
/
sn.log
The syntax of the mail command is as follows:
Usage:mail[
-
iInv][
-
ssubject][
-
ccc
-
addr][
-
bbcc
-
addr]to
-
addr...
[
-
-
sendmail
-
options...]
mail[
-
iInNv]
-
f[name]
mail[
-
iInNv][
-
uuser]
Test successful