Question

Up until now I've been using script/runner to forward bouncebacks to eblast-bounceback@mydomain.com and eblast-bounceback@dev.mydomain.com. However it is no longer working in Rails 4.0. I also can't seem to find a good resource online to illustrate how to do it. I usually get directed to the 'whenever' gem - but that's for cron jobs, not for 'piping to programs'.

So this is essentially what I'm currently doing, but is failing:

|/home/user/rails/dev.www/script/rails runner 'EBlast.receive(STDIN.read)' -e development

How do I get this to work? I'm not on Rails 4.1, I'm on 4.0. FWIW I do not have bin/rails. The above command yields "no such file or directory".

Was it helpful?

Solution

There were actually a few things I needed to do.

The email eblast-bounce@dev.mydomain.com was considered 'unroutable'. At first I figured it was because there wasn't any MX records for the subdomain, so I added one. But then I still got the error. I had manually updated the aliases file in /etc/valiases to pipe to the program using a symlinked directory (because I was deploying with Capistrano, and the directory ends up changing after every deploy). Turns out symlinks don't work for some reason when it comes to exim routing (/home/me/rails_deployments/dev.www/current/bin/rails fails). Maybe I'm wrong about the symlinks thing but the problem went away when I used the solution below.

This problem however was solved when I eventually came to another problem (/usr/bin/env: ruby: No such file or directory). I'm using RVM to manage rubies/gems, and apparently the email forwarder didn't know what ruby was. This leads to the final solution:

(when in cPanel, "pipe to program" assumes the user home directory (/home/me/))
.rvm/wrappers/ruby-2.1.0@website/ruby /home/me/rails_deployments/dev.www/current/bin/rails runner 'EBlast.receive(STDIN.read)' -e development

Where ruby-2.1.0 is my current ruby version, and @website is the gemset used by the EBlast.receive code base.

EDIT: Spoke too soon, the command has its own set of problems...(gemfile not present). This is ludicrous.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top