[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-beginners
Subject:    Re: newbie pipe stdin to sendmail
From:       Mark Coetser <mark () tux-edo ! co ! za>
Date:       2016-11-03 6:41:54
Message-ID: 581ADC32.5020607 () tux-edo ! co ! za
[Download RAW message or body]


On 02/11/2016 22:14, Andy Bach wrote:
> #!/usr/bin/perl
>
> my $vacation_forward = 'vacation@domain.com <http://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 OUT $_;
>      }
> close (OUT);
>
> if ($email_addr_to) {
>      print "$email_addr_to\n";
>      }

Thank you

Nice and simple and thanks for the explanation it helps me understand.

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic