Re: newbie pipe stdin to sendmail

2016-11-03 Thread Mark Coetser
On 02/11/2016 22:14, Andy Bach wrote: #!/usr/bin/perl my $vacation_forward = 'vacat...@domain.com '; open(OUT, "|/usr/sbin/sendmail $vacation_forward") or die ("Can't sendmail - $!"); my $email_addr_to = ''; while ( <>) { $email_addr_to = $1 if /^To: (.*)$/; print

Re: newbie pipe stdin to sendmail

2016-11-02 Thread Mark Coetser
On 02/11/2016 19:35, Andy Bach wrote: On Wed, Nov 2, 2016 at 9:13 AM, Mark Coetser > wrote: $parser->ignore_errors(1); $parser->output_to_core(1); my $entity = $parser->parse(\*STDIN); my $error = ($@ || $parser->last_error);

newbie pipe stdin to sendmail

2016-11-02 Thread Mark Coetser
Hi OK, complete newbie to perl. I am busy playing around/learning and I wanted to create a simple perl script that I can pipe an email too and then grab the To header and output that and then pipe the unmodified email to sendmail with a different recipient... similar to cat