Can I forward to a shell pipe?


#1

I would like to cause all of the mail sent to the
email address fudforum-player@forum.mysite.org
to be forwarded to this shell pipe
"|/home/myaccount/fudforum/scripts/maillist.php 2"

Can I do this by using a Forward-Only Email and
putting the above string into the “List all email
addresses” box? If not, is there any other way to
accomplish this end?


#2

Well I tried it and it is not allowed. I will have to look for another way.


#3

first create that as a regular email account (email servers are differnt than webservers)
then in the panel click the “message filters” and create a filter to forward to a shell account.
(People seem to sometimes has trouble with using a wildcard for all, the way I did it for all was “subject does NOT contain 'kfjdksjfsdkfjdkfjkdsfjd”)
then within the shell you also need to add a .forward.postfix in your home directory to pipe it to your script.


#4

I think that I have the concept of your solution but I am having some trouble with the details.

Could you please provide an example of the contents of the .forward.postfix file.
I am guessing that it would look something like this [but I’m probably wrong]:

fudforum-player |/home/myaccount/fudforum/scripts/maillist.php 2

Also I cannot find a “forward to a shell account” choice on the “Add New Filter” page.
Will the “Forward it to email address:” choice work?

And, if so, what would I put in that field?


#5

You must not be in the right place. You must edit this type of filter from this page in the panel: https://panel.dreamhost.com/index.cgi?tree=mail.filters&

click Edit for the account you are adding the filter for, then on the next page “add new filter”. On the next page you will see a radio button for "Forward it to a shell account: " and a drop down list just below that for which of your shell users to forward to.

the .forward.postfix would be:
|/home/myaccount/fudforum/scripts/maillist.php 2

More info here: http://wiki.dreamhost.com/Email_to_Script

essentially you are forwarding the email twice, once from the mail server to a web server shell account, and then that shell account to a script within that shell account.


#6

I am making some progress on this but I still have some ways to go.

The FUDForum side of things seems to be working. If I enter

/home/myaccount/fudforum/scripts/maillist.php 2 < FakeEmail.eml

on the command line, the Fake Email gets posted to the forum. Yay!

But, emails sent to the Mailman list still don’t make it to the forum.

My .forward.postfix file resides in /home/myaccount and contains the line

|/home/myaccount/fudforum/scripts/maillist.php 2

And “Filters for mailbox: fudforum-player@forum.board18.org” contains:

“First, forward emails without zxcvbbvcxzzxcvb in the subject to myaccount on hanover and then stop.”

And fudforum-player@forum.board18.org has been added as a member to the Mailman list.

But there must still be something wrong. Any ideas?
[hr]
Just decided to look at your suggested WIKI page http://wiki.dreamhost.com/Email_to_Script
I found this message in a pink box at the top of the page:

NOTE: As of April 2008, tying an email address configured on the “Manage Email” page of the web panel to a shell user is no longer allowed, so the instructions in this section no longer work. (Email addresses that were already tied to shell users have been grandfathered.) What you can do instead is forward email to the shell user, since every shell user appears to implicitly have an email address of the form user@webserver.dreamhost.com.
Here are instructions on how to forward to a shell user (worked as of 12/23/2010): Shell-linked_E-mail


Could this be the reason for my problems?