[root@calpsv04 log]# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
local_recipient_maps =
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 15728640
mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain
mydomain = apmro.com.sg
myhostname = mail.apmro.com.sg
mynetworks = 172.28.2.0/24,127.0.0.0/8,172.28.1.0/24,203.115.216.0/24,58.247.112.0/24
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relay_domains = $mydestination
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
本地通过Telnet能正常发信
先获得SMTP认证的用户名和密码的base64。得到一个字串。
[root@calpsv04 etc]# printf '\0%s\0%s' 'info' 'password' | openssl base64
AGluZm8AYWxwaGExMjM=
然后telnet邮件服务器,红色字体为手动输入的命令。
[root@calpsv04 log]# telnet mail.apmro.com.sg 25
Trying 203.115.216.134...
Connected to mail.apmro.com.sg.
Escape character is '^]'.
220 mail.apmro.com.sg ESMTP Postfix (2.6.6)
EHLO mail.apmro.com.sg
250-mail.apmro.com.sg
250-PIPELINING
250-SIZE 15728640
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN AGluZm8AYWxwaGExMjM=
235 2.7.0 Authentication successful
MAIL FROM:<info@apmro.com.sg>
250 2.1.0 Ok
RCPT TO:radzhang@gainwinsoft.com
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
FROM:info@apmro.com.sg
TO:radzhang@gainwinsoft.com
Subject:test message
test test 0616
.
250 2.0.0 Ok: queued as 20C7241141
quit
221 2.0.0 Bye
Connection closed by foreign host.
这样邮箱正常收到了邮件。
但是在outlook里设置smtp后,验证通过了。但是发信就直接退回来了。
服务器错误: '554 5.7.1 <zhang@hotmail.com>: Relay access denied'。
尝试着把我外网的IP 网段58.247.112.0/24加入到main.cf里的mynetworks参数内,结果就能正常发信了。
难道所有要用smtp发信的邮箱服务器都得把相应的外网网段都加上吗?