22
32

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

postfix メール設定メモ

Last updated at Posted at 2015-09-27

*Update版をCentOS7 Postfix + SMTP-Auth/Submission PortとしてPost

概要

  • postfixを利用するときのよくやる設定メモ

環境

  • OS:CentOS /Redhat 6.x
  • postfix:postfix-2.6.x

手順

main.cf 設定

  • 追加したり変更したりする点
/etc/postfix/main.cf
# myhostnameにホスト名を指定
myhostname = mail.hogehoge.com  

# mydomainにドメイン名を指定
mydomain = hogehoge.com

# myoriginのコメント削除
myorigin = $mydomain

# inet_protocolをipv4に限定
inet_protocols = ipv4

# mydestination設定変更
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# mynetworksを自環境に合わせ変更
mynetworks = 127.0.0.0/8,192.168.0.0/24,10.0.0.0/8

# relay_domainsのコメント削除
relay_domains = $mydestination

# header_checksのコメント削除
header_checks = regexp:/etc/postfix/header_checks

# smtpd_banne設定
smtpd_banner = $myhostname ESMTP

# 最下行に以下追記
message_size_limit = 5242880
disable_vrfy_command = yes
smtpd_helo_required = yes
strict_rfc821_envelopes = yes
allow_percent_hack = yes
swap_bangpath = yes
allow_untrusted_routing = no
smtpd_client_restrictions =
   permit_mynetworks,
   reject_unknown_client,
   permit
smtpd_data_restrictions =
   reject_unauth_pipelining,
   reject_multi_recipient_bounce
smtpd_helo_restrictions =
   permit_mynetworks,
   reject_invalid_hostname,
   reject_non_fqdn_hostname,
   reject_unknown_hostname,
   permit
smtpd_sender_restrictions =
   permit_mynetworks,
   reject_unknown_sender_domain,
   reject_non_fqdn_sender,
   permit
smtpd_recipient_restrictions =
   permit_mynetworks,
   reject_non_fqdn_recipient,
   reject_unknown_recipient_domain,
   reject_unauth_destination,
   permit
smtpd_etrn_restrictions =
   permit_mynetworks,
   reject_invalid_hostname,
   permit

header_checks設定

  • Receivedから始まる行を削除
/etc/postfix/header_checks
/^Received:/ IGNORE

サービス起動


# service postfix restart
# chkconfig postfix on

メール送信確認

  • 適当なメールアドレスに向けて送信確認

\# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.hogehoge.com ESMTP

HELO hogehoge.com
250 mail.hogehoge.com

MAIL FROM:\           
250 2.1.0 Ok

RCPT TO:\
250 2.1.5 Ok

DATA
354 End data with .
Hello test mail
.
250 2.0.0 Ok: queued as 952E42FD

quit
221 2.0.0 Bye
Connection closed by foreign host.
22
32
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
32

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?