[Dovecot] Newbie Question/Feature Request
Hi,
I'm working on a plugin for qpsmtpd (a perl smtp frontend) that delivers mail via dovecot's LDA. I can only get mail delivered by writing the email to file, then calling 'deliver -d someone -f someone-else < /path/to/temp/email' All good, expected behavior. A perl snippet:
local $/=undef; open FH, "< ./demo.mail"; my $stringified = <FH>; # this is roughly equivalent to how other LDA queues work. close FH;
open (CMD_OUT, " /usr/lib/dovecot/deliver -f somedude\@someplace.com -d anotherdude\@destination.dom $stringified |"); my $test = <CMD_OUT>; print $test;
The above code errors out because the expected behavior is $stringified is supposed to be a file name. It would be great if deliver could be fed the email as a string so I don't have to add a step of writing to file. Or, maybe there's an undocumented method?
Thanks. mpapet
On Sat, 2011-11-05 at 10:33 -0700, Michael Papet wrote:
open (CMD_OUT, " /usr/lib/dovecot/deliver -f somedude\@someplace.com -d anotherdude\@destination.dom $stringified |"); my $test = <CMD_OUT>; print $test;
The above code errors out because the expected behavior is $stringified is supposed to be a file name. It would be great if deliver could be fed the email as a string so I don't have to add a step of writing to file. Or, maybe there's an undocumented method?
I don't remember exactly how Perl works, and this is untested, but I think it should be something like:
open (CMD_OUT, "| /usr/lib/dovecot/deliver -f somedude\@someplace.com -d anotherdude\@destination.dom"); print CMD_OUT $stringified; my $test = <CMD_OUT>; print $test;
The idea is that you write the string to the pipe to deliver that you open, and deliver reads it from stdin.
participants (2)
-
Michael Papet
-
Timo Sirainen