function sendMail($from, $fromname, $recipient, $subject, $body, $attachment = NULL, $html = NULL, $cc = NULL, $bcc = NULL) { if ($this->dying) { return; } $mail = bf_createMail($from, $fromname, $subject, $body); if (is_array($recipient)) { foreach ($recipient as $to) { $mail->AddAddress($to); } } else { $mail->AddAddress($recipient); } if ($attachment) { if (is_array($attachment)) { $attCnt = count($attachment); for ($i = 0; $i < $attCnt; $i++) { $mail->AddAttachment($attachment[$i]); } } else { $mail->AddAttachment($attachment); } } // if if (isset($html)) { $mail->IsHTML($html); } if (isset($cc)) { if (is_array($cc)) { foreach ($cc as $to) { $mail->AddCC($to); } } else { $mail->AddCC($cc); } } // if if (isset($bcc)) { if (is_array($bcc)) { foreach ($bcc as $to) { $mail->AddBCC($to); } } else { $mail->AddBCC($bcc); } } // if if (!$mail->Send()) { $this->status = _FF_STATUS_SENDMAIL_FAILED; $this->message = $mail->ErrorInfo; } // if }
function bf_sendNotificationByPaymentCache($formId, $recordId, $type = 'admin'){ $contents = array(); $sourcePath = JPATH_SITE . '/administrator/components/com_breezingforms/payment_cache/'; if (@file_exists($sourcePath) && @is_readable($sourcePath) && @is_dir($sourcePath) && $handle = @opendir($sourcePath)) { while (false !== ($file = @readdir($handle))) { if($file!="." && $file!="..") { $parts = explode('_', $file); if(count($parts)==4) { if($parts[0] == intval($formId) && $parts[1] == intval($recordId) && $parts[2] == $type) { $contents = unserialize(JFile::read($sourcePath.$file)); JFile::delete($sourcePath.$file); break; } } } } @closedir($handle); } if(count($contents) != 0){ $from = $contents['from']; $fromname = $contents['fromname']; $recipient = $contents['recipients']; $subject = $contents['subject']; $body = $contents['body']; $attachment = $contents['attachment']; $html = $contents['isHtml']; if((is_array($recipient) && count($recipient) != 0) || ( !is_array($recipient) && $recipient != '' )){ $mail = bf_createMail($from, $fromname, $subject, $body); if (is_array($recipient)) foreach ($recipient as $to) $mail->AddAddress($to); else $mail->AddAddress($recipient); if ($attachment) { if ( is_array($attachment) ) foreach ($attachment as $fname) $mail->AddAttachment($fname); else $mail->AddAttachment($attachment); } // if if (isset($html)) $mail->IsHTML($html); $mail->Send(); } } }