Maybe one more Postfix.pm fix...?

Markus Nilsson markus at markusoft.se
Thu Feb 17 10:52:03 GMT 2011


Hi Jules! 

Thanks for the patch! While you are digging in the Postfix.pm; any chance that you might want to revisit an old suggestion? :) 

The Postfix.pm code does not update the size field in the queue file, when the size has been changed for some reason (e.g., removal of an attachment). For us this gives us problems when removing large attachments on outgoing mails, because the receiving mail server will block it due to the reported size being too big; even though the mail itself actually is smaller. 

I have added the following code to the sub PreDataString 
(The $message->{rewriteCHeader} is set by my custom function that strips attachments, the size field is also set by the attachment stripper.) 




foreach (@{$message->{metadata}}) { 
  /^(.)(.*)$/; 
  ($type, $data) = ($1, $2); 
  $TimestampFound++ if $type eq 'T'; # Must only ever have 1 timestamp 

  ############################################################################################## 
  #Added Code # 
  ############################################################################################## 
  if($type eq 'C' and $message->{rewriteCHeader} eq 'y')
  {
    if ($data =~ m/(\D+)\d+(\D+\d+\D+\d+\D+\d+\D+)\d+/)
    {
      $data = "" . $1 . $message->{size} . $2 . $message->{size};
    }
  }
  ############################################################################################## 





Best Regards 
Markus Nilsson 

 
 
--
This message has been scanned for viruses and dangerous content by CronLab
(www.cronlab.com), and is believed to be clean.



More information about the MailScanner mailing list