Troncage du sujet après les 255 premiers caractères

This commit is contained in:
Daniel Berteaud 2012-10-11 12:57:23 +02:00
parent c6cea9d36e
commit 0a3b5d51df
1 changed files with 6 additions and 1 deletions

View File

@ -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;