/usr/lib/dovecot/deliver -f test@somedomain.com -d test@mailtask.dom < demo.mail #### use strict; open FH, "< ./demo.mail"; my @all = ; close FH; my $stringified = ''; foreach (@all) { $stringified .= $_; } #print $stringified; close STDOUT; my $test = open (STDOUT, ' $stringified | /usr/lib/dovecot/deliver -f test\@somedomain.com -d test\@mailtask.dom '); print $test;