Skip to content

Commit

Permalink
Dev Added support for multiple attachment in helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Mar 20, 2013
1 parent 510593b commit 316b1e7
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions application/helpers/common_helper.php
Expand Up @@ -4328,7 +4328,7 @@ function javascriptEscape($str, $strip_tags=false, $htmldecode=false) {
* @param mixed $attachment
* @return bool If successful returns true
*/
function SendEmailMessage($body, $subject, $to, $from, $sitename, $ishtml=false, $bouncemail=null, $attachment=null, $customheaders="")
function SendEmailMessage($body, $subject, $to, $from, $sitename, $ishtml=false, $bouncemail=null, $attachments=null, $customheaders="")
{

global $maildebug, $maildebugbody;
Expand Down Expand Up @@ -4472,9 +4472,22 @@ function SendEmailMessage($body, $subject, $to, $from, $sitename, $ishtml=false,
$mail->Body = $body;
}

// add the attachment if there is one
if(!is_null($attachment))
$mail->AddAttachment($attachment);
// Add attachments if they are there.
if (is_array($attachments))
{
foreach ($attachments as $attachment)
{
// Attachment is either an array with filename and attachment name.
if (is_array($attachment))
{
$mail->AddAttachment($attachment[0], $attachment[1]);
}
else
{ // Or a string with the filename.
$mail->AddAttachment($attachment);
}
}
}

if (trim($subject)!='') {$mail->Subject = "=?$emailcharset?B?" . base64_encode($subject) . "?=";}
if ($emailsmtpdebug>0) {
Expand Down

0 comments on commit 316b1e7

Please sign in to comment.