Skip to content

Instantly share code, notes, and snippets.

@3014zhangshuo
Forked from FUT/header_checks
Created May 21, 2021 03:55
Show Gist options
  • Save 3014zhangshuo/23c9e0572ae136af462542c832e73140 to your computer and use it in GitHub Desktop.
Save 3014zhangshuo/23c9e0572ae136af462542c832e73140 to your computer and use it in GitHub Desktop.
Postfix email to Rails
# File: /etc/postfix/header_checks
# Add to the bottom of the file
/To:.*support@myapp.com.*/ FILTER send_to_my_app:
# File: /etc/postfix/main.cf
# Make sure you have next line in the file
header_checks = regexp:/etc/postfix/header_checks
# File: /etc/postfix/master.cf
# Add to the bottom
send_to_my_app unix - n n - - pipe
flags=Xhq user=yury directory=/home/yury/MyApp/production/current argv=sh ./receive_mail.sh
# File: ../shared/receive_mail.sh
/home/yury/.rvm/bin/rvm 2.1.5@my_gemset do bundle exec rails runner -e production "SomeMailer.receive(STDIN.read)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment