Closed (fixed)
Project:
Mail Logger
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Mar 2009 at 06:04 UTC
Updated:
4 Jun 2014 at 08:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
litwol commentedCan you debug what exactly is breaking email attachments?
Comment #2
ulf1 commentedNo, I have not debugged into Mail logger, but from looking into the code it is pretty obvious what causes the problem.
In function mail_logger_mail_alter(&$message),
the message body itself is being modified to prepare it for the mail_logger table.
$message['body'] = is_array($message['body']) ? drupal_wrap_mail(implode("\n\n", $message['body'])) : drupal_wrap_mail($message['body']);
I am pretty sure that if the code would work with a copy of the message body it will work:
$logger_message['body'] = is_array($message['body']) ? drupal_wrap_mail(implode("\n\n", $message['body'])) : drupal_wrap_mail($message['body']);
$args = array(
$message['id'],
$message['to'],
$message['subject'],
$logger_message['body'],
$message['from'],
serialize($message['headers']),
time(),
$message['language']->language,
);
instead of
$message['body'] = is_array($message['body']) ? drupal_wrap_mail(implode("\n\n", $message['body'])) : drupal_wrap_mail($message['body']);
$args = array(
$message['id'],
$message['to'],
$message['subject'],
$message['body'],
$message['from'],
serialize($message['headers']),
time(),
$message['language']->language,
);
~
Ulf
Comment #3
ulf1 commentedComment #4
mokko commentedSince the purpose is to log emails and NOT to change them, I suggest to not to use a reference in mail_logger_mail_alter so that we are safe.
Comment #5
mokko commentedComment #7
fizk commentedFixed, thanks!