CRM-21395 port https://github.com/dompdf/dompdf/pull/1570/files using patch files...
[civicrm-core.git] / tools / scripts / procmail / original-to.pl
1 #!/usr/bin/perl -w
2 # for use as a procmail filter
3 #
4 # :0
5 # * X-Original-To: bounce.*
6 # | original-to.pl
7
8 use strict;
9 use MIME::Parser;
10 use MIME::Entity;
11
12 my $parser = new MIME::Parser;
13
14 my $entity = $parser->parse(\*STDIN);
15
16 my $orig = $entity->head->get('X-Original-To',0);
17 my $to = $entity->head->get('To',0);
18
19 $entity->head->replace('To', $orig);
20 $entity->head->replace('X-Original-To', $to);
21
22 $entity->smtpsend(Host => 'localhost');