Postfix -> perl/ruby (ActionMailer) question


#1

Hi guys, I am a ruby nuby, and am trying to learn ruby while setting up
a craigslist-like site.
So instead of going all out with ActionMailer, right now I am trying to
start very simple with perl and am having difficulties.

I read this document:
http://wiki.rubyonrails.com/rails/pages/HowToReceiveEmailsWithActionMailer

and modified my main.cf, transport, and master.cf.

The line added to my master.cf looks like this:
#stuff for rubymail 2006.04.16
rmail unix - n n - - pipe flags=FR
user=nobody argv=/usr/local/bin/mailtest.pl ${user}

I’m assuming the message should be passed to my program as STDIN, so
something very simple like
the following, should write the recieved message to a file:

#!/usr/bin/perl

open (OF,">>/var/log/rmail.log");
print OF “newmessage\n”;
while (<>) {
print OF $_;
}
print OF “-------------------------------------------------------\n”;

Now when I send mail to removed_email_address@domain.invalid, mailtest.pl
is invoked and data is
written to /var/log/rmail.log. However only the following lines are
written:

newmessage

I can trigger my script from postfix, but I don’t get the contents of
message.

Obviously this is more a postfix question than a ruby question, but
many of you Rails gurus may
have seen this before.

Thanks for any help,

Rohit