diff --git a/root/usr/share/qpsmtpd/plugins/logging/log2sql b/root/usr/share/qpsmtpd/plugins/logging/log2sql index 124616e..24d1241 100644 --- a/root/usr/share/qpsmtpd/plugins/logging/log2sql +++ b/root/usr/share/qpsmtpd/plugins/logging/log2sql @@ -136,8 +136,13 @@ my($header) = $transaction->header(); #'touch' this message :-)) $header->add("X-Sql-Log-ID",$mail_id); +my $subject = scalar $header->get("Subject"); +chomp($subject); +# Only keep the first 255 chars to be sure it can be inserted in the table +$subject= substr $subject, 0, 254; + my($statement) = "UPDATE ".$mail_table." SET subject=". - $dbh->quote(scalar $header->get("Subject")). + $dbh->quote($subject). ",header_size=".$dbh->quote(length($header->as_string())). ",body_size=".$dbh->quote($transaction->body_size()). " WHERE mail_id=".$mail_id;