LoginSignup
7
10

More than 5 years have passed since last update.

AWS+PostfixでSMTPリレーの設定

Posted at

はじめに

AWS+postfix+smtpリレーの設定をすることになったのでそのメモになります。
最初はsendmailで設定したのですが、postfixのほうが個人的には好きなので変更しました。

環境)
お名前.com
AWS
postfix

概要

  1. Postfixインストール
  2. main.cfの変更
  3. テスト

詳細


1. Postfixインストール

AWSのデフォルトがsendmailだったのでpostfixを入れる。

# yum insatll postfix
:
# service sendmail stop
# chkconfig sendmail off
# chkconfig postfix on

2. main.cfの変更

設定の変更を行います。

# vim /etc/postfix/main.cf
myhostname = XXXXX
mydomain = XXXXX.jp
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

local_header_rewrite_clients = static:all
canonical_classes = envelope_sender
canonical_maps = regexp:/etc/postfix/canonical.regexp

# vim /etc/postfix/canonical.regexp
/.*/ no-reply@XXXXX.jp

※SMTPリレー先のの制限でenvelope-FROMを強制的に付与させちゃいました。

# service postfix restart

3. テスト

メール送信してみてテストする。
メール到達すればOK

# hostname | mail -s 'TEST' XXXX@xxxxxx.jp

あとがき

とりあえずこれで、postfixで通知されることが確認できました。またPHPからの送信テストも書いてませんがやりましたが、問題なく通知されました。

その他

参考)
Postfix でメールリレーの設定 (SMTP クライアント + SMTP Auth)
【postfix】envelope-FROMを強制的に付与する

7
10
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
7
10