Skip to content

Instantly share code, notes, and snippets.

@FUT
Created November 14, 2014 10:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save FUT/b0ea7e21214601e533bd to your computer and use it in GitHub Desktop.
Save FUT/b0ea7e21214601e533bd 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)"
@FUT
Copy link
Author

FUT commented Nov 14, 2014

This config does not preserve email for original recipient

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