Using the Perl's Mail::Module you can get and set the email header informations.
For further informations please visit the perl's CPAN search about Mail::Header