From: <da...@i-...> - 2004-01-15 00:27:01
|
I would like to be able to edit the message header in code that runs from check_mail() (that is, before the message is about to be given back to the MTA). This would be a simple matter of adding Cc: to the message header. I can see two routes to go: 1. Use $msginfo->recips. 2. Use Amavis::Out::EditHeader. $msginfo->recips allows me to rebuild the actual recipient list, but not to actually edit the header. However, it might be a way to implement a Cc- or Bcc-like method of delivering mail to another user. Amavis::Out::EditHeader lets me edit the actual headers, but it seems like it was written to be used only right before the message is delivered to the next hop. This means that it might be the right choice when doing work in check_mail(). Playing around, I tried this: check_mail() { ... my($hdr_edits) = $msginfo->header_edits; $hdr_edits = Amavis::Out::EditHeader->new if !$hdr_edits; $hdr_edits->append_header('Cc', quote_rfc2821_local('bob@localhost')); ... } Leaving this as is doesn't work. However, it is premature to do a write_header() I believe before we get to something like mail_to_local_mailbox() (or whatever). What is the best solution for doing something along these lines? |