Browse files

JMail bug fix.

  • Loading branch information...
1 parent ef65e3a commit fbf0f634fd97283a164a68e6118908462c62111b @dianaprajescu committed Mar 23, 2012
Showing with 14 additions and 2 deletions.
  1. +14 −2 libraries/joomla/mail/mail.php
View
16 libraries/joomla/mail/mail.php
@@ -279,9 +279,21 @@ public function addAttachment($attachment, $name = '', $encoding = 'base64', $ty
{
if (is_array($attachment))
{
- foreach ($attachment as $file)
+ if(!empty($name) && sizeof($attachment) != sizeof($name))
{
- parent::AddAttachment($file, $name, $encoding, $type);
+ throw new RuntimeException("The number of attachments must be equal with the number of name");
+ }
+
+ for ($i=0; $i<sizeof($attachment); $i++)
+ {
+ if (!empty($name))
+ {
+ parent::AddAttachment($attachment[$i], $name[$i], $encoding, $type);
+ }
+ else
+ {
+ parent::AddAttachment($attachment[$i], $encoding, $type);
+ }
}
}
else

0 comments on commit fbf0f63

Please sign in to comment.