0

I'm new with Perl and i need to read one email from Exchange and add one ID to the subject with Perl.

I was searching and i had found:

Mail::Internet splits a message into a header object in the Mail::Header class, plus a body. You can get and set individual headers through this object:

my $subject = $obj->head->get("Subject");
$obj->head->replace("Subject", "New subject");

But i simply can't understand how to make the script to change the subject.

Can anyone help?

Thanks in advance,

ARode
  • 17
  • 3
  • What happens to your Mail::Header object after you do $obj->head->replace(...) ? i.e. dump out its contents ( with Data::Dumper) before and after you call ->replace. Do you notice a difference? – xxfelixxx Apr 21 '16 at 02:39

1 Answers1

0

This works for me :

my $header = $entity->head;
my $subject = $entity->head->get('subject');
$header->replace('Subject', "Some new subject");
Guest
  • 58