Table of Contents
chinaz.org SMTPリレーを使用したPostfixメール転送設定
AlmaLinux 9のPostfixからsmtp.chinaz.org:587経由でメールを送信する設定例です。
SMTP認証情報は、メールサービスの管理者から取得した値を設定してください。
インストール
# dnf install postfix cyrus-sasl-plain
postfixの設定
main.cf
# cp /etc/postfix/main.cf /etc/postfix/main.cf.org
# vi /etc/postfix/main.cf
--------------------------------
home_mailbox = Maildir/
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/password_maps
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
--------------------------------
転送設定(transport)
# vim /etc/postfix/transport
--------------------------------
localhost local:
localhost.localdomain local:
redmine.localdomain local:
* smtp:[smtp.chinaz.org]:587
--------------------------------
# postmap /etc/postfix/transport
SMTP設定
# vi /etc/postfix/password_maps
--------------------------------
[smtp.chinaz.org]:587 ログオンアカウント:REPLACE_WITH_SMTP_PASSWORD
--------------------------------
# chmod 600 /etc/postfix/password_maps
# postmap /etc/postfix/password_maps
# chmod 600 /etc/postfix/password_maps.db
認証情報を文書や共有ログへ貼り付けず、実際の値に置き換えてください。
postmapで生成されるDBにも認証情報が含まれるため、ファイル権限を制限します。
サービス
・有効化・起動・状態
# systemctl enable postfix
# systemctl start postfix
# systemctl status postfix
forwardでメールの転送設定
管理者宛てのメールをuser@chinaz.orgへ転送します。
# vi ~/.forward
--------------------------------
user@chinaz.org
--------------------------------
送信テスト
[china@redmine ~]$ mail -s "test send" root
TESTコメント
.
