Skip to content

Instantly share code, notes, and snippets.

@evalphobia
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evalphobia/7520ba50e7d92e8acd58 to your computer and use it in GitHub Desktop.
Save evalphobia/7520ba50e7d92e8acd58 to your computer and use it in GitHub Desktop.
開発用 メール送信先 制限設定(posfix)

postfixのインストールと起動

$ su - 
# yum install postfix
# alternatives --display mta  # 確認
# alternatives --config mta  # 確認

2 プログラムがあり 'mta' を提供します。

  選択       コマンド
-----------------------------------------------

*+ 1           /usr/sbin/sendmail.sendmail
   2           /usr/sbin/sendmail.postfix
   
Enter を押して現在の選択 [+] を保持するか、選択番号を入力します: 2

$ /etc/init.d/sendmail stop
$ lsof -i :25
$ /etc/init.d/postfix start

メール送信先の制限

# cd /etc/postfix/
# cp -p main.cf main.cf_`date +"%Y%m%d"`
# vim main.cf

// ↓を追記
canonical_maps = regexp:/etc/postfix/canonical.regexp
$ vim canonical.regexp

# ↓ 送信先ドメインを全て @hogehoge.comにする
/@.+$/ @hogehoge.com

# ↓ 送信先ユーザー名を全て evalphobia にする
/^.+/ evalphobia

# ↓ 送信先アドレスを全て evalphobia@hogehoge.com にする
/^.+$/ evalphobia@hogehoge.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment