####smtp 协议####
smtp协议就是简单邮件传输。
(1)首先做好dns解析
vim /etc/named.conf
// listen-on port 53 { 127.0.0.1; };
// listen-on-v6 port 53 { ::1; };
// allow-query { localhost; };
dnssec-validation no;
vim /etc/named.rfc1912.zones
zone "westos.com" IN {
type master;
file "westos.com.zone";
allow-update { none; };
};
zone "linux.com" IN {
type master;
file "linux.com.zone";
allow-update { none; };
};
vim westos.com.zone
$TTL 1D
@ IN SOA dns.westos.com. root.westos.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westos.com.
dns A 172.25.254.109
westos.com. MX 1 172.25.254.109.
vim linux.com.zone
$TTL 1D
@ IN SOA dns.linux.com. root.linux.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.linux.com.
dns A 172.25.254.109
linux.com. MX 1 172.25.254.209.
vim /etc/postfix/main.cf
75 myhostname = maillinux.linux.com
83 mydomain = linux.com
99 myorigin = $mydomain
113 inet_interfaces = all
116 #inet_interfaces = localhost
164 mydestination = $myhostname,$mydomain, localhost
systemctl restart postfix.service
(2)出站地址伪装
cd /etc/postfix/
vim generic
root@westos.com xxxxxxxx@qq.com
|| ||
真实地址 假地址
postmap generic
postconf -d | grep generic
postconf -e "smtp_generic_maps =hash:/etc/postfix/generic"
systemctl restart postfix.service
(3)远程邮件发送
yum install telnet -y ##安装
telnet 172.25.254.109 25
[root@foundation9 ~]# telnet 172.25.254.109 25
Trying 172.25.254.109...
Connected to 172.25.254.109.
Escape character is '^]'.
220 mailwestos.westos.com ESMTP Postfix
ehlo hello
250-mailwestos.westos.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from
501 5.5.4 Syntax: MAIL FROM:<address>
mail from:root@westos.com
250 2.1.0 Ok
rcpt to:root@linux.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
afsa
dsd
sdw
sws
.
250 2.0.0 Ok: queued as 830D917E861
quit
221 2.0.0 Bye
Connection closed by foreign host.
##在邮件发送中"."表示结束。
转载于:https://blog.51cto.com/12183531/1878575