Skip to content

Commit

Permalink
Fixed argument errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Jan 15, 2022
1 parent d1d61ff commit 3844202
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions system/classes/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private static function replacePlaceHolders($address, $body)
* @param string|array $to recipients name and email address
* @param string $subject subject of the email
* @param string $body the text of the email
* @param string|array $from (optional) sender of the the email
* @param string|array $from (optional) sender of the email
* @param bool $html (optional) true if to be sent as HTML email
* @param int $priority (optional) add X-Priority header, if > 0
* @param mixed $optional (optional) other headers or CC:
Expand Down Expand Up @@ -162,11 +162,21 @@ public static function send($to, $subject, $body, $from = '', $html = false, $pr
if (empty($from)) {
$mail->setFrom($_CONF['site_mail'], $_CONF['site_name']);
} else {
$mail->setFrom($from);
if (is_array($from)) {
reset($from);
$mail->setFrom(key($from), current($from));
} else {
$mail->setFrom($from);
}
}

// Set recipient(s)
$mail->addAddress($to);
// Set recipient
if (is_array($to)) {
reset($to);
$mail->addAddress(key($to), current($to));
} else {
$mail->addAddress($to);
}

// Add Cc and Bcc
if (!empty($optional) && !is_array($optional)) {
Expand Down

0 comments on commit 3844202

Please sign in to comment.