//$rc = $mail->quickMail($line["email"], $line["login"], DIGEST_SUBJECT, $digest, $digest_text);
- $rc = $mailer->mail(["to" => $line["login"] . " <" . $line["email"] . ">",
+ $rc = $mailer->mail(["to_name" => $line["login"],
+ "to_address" => $line["email"],
"subject" => DIGEST_SUBJECT,
"message" => $digest_text,
"message_html" => $digest]);
function mail($params) {
- $to = $params["to"];
+ $to_name = $params["to_name"];
+ $to_address = $params["to_address"];
$subject = $params["subject"];
$message = $params["message"];
$message_html = $params["message_html"];
- $from = $params["from"] ? $params["from"] : SMTP_FROM_NAME . " <" . SMTP_FROM_ADDRESS . ">";
+ $from_name = $params["from_name"] ? $params["from_name"] : SMTP_FROM_NAME;
+ $from_address = $params["from_address"] ? $params["from_address"] : SMTP_FROM_ADDRESS;
+
$additional_headers = $params["headers"] ? $params["headers"] : [];
- $headers[] = "From: $from";
+ $from_combined = $from_name ? "$to_name <$to_address>" : $to_address;
+ $to_combined = $to_name ? "$to_name <$to_address>" : $to_address;
- Logger::get()->log("Sending mail from $from to $to [$subject]: $message");
+ Logger::get()->log("Sending mail from $from_combined to $to_combined <$to_address> [$subject]: $message");
// HOOK_SEND_MAIL plugin instructions:
// 1. return 1 or true if mail is handled
return $rc;
}
- return mail($to, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers)));
+ $headers[] = "From: $from_combined";
+
+ return mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers)));
}
function set_error($message) {
$this->last_error = $message;
}
- function error($value) {
+ function error() {
return $this->last_error;
}
}
$mailer = new Mailer();
- $rc = $mailer->mail(["to" => "$login <$email>",
+ $rc = $mailer->mail(["to_name" => $login,
+ "to_address" => $email,
"subject" => __("[tt-rss] Password change notification"),
"message" => $message]);
$mailer = new Mailer();
- $mailer->mail(["to" => $to,
+ $rc = $mailer->mail(["to_address" => $to,
"headers" => ["Reply-To: $from"],
"subject" => $subject,
"message" => $message]);
"If that wasn't you, just ignore this message. Thanks.";
$mailer = new Mailer();
- $rc = $mailer->mail(["to" => $email,
+ $rc = $mailer->mail(["to_address" => $email,
"subject" => "Registration information for Tiny Tiny RSS",
"message" => $reg_text]);
"Email: $email\n";
$mailer = new Mailer();
- $rc = $mailer->mail(["to" => REG_NOTIFY_ADDRESS,
+ $rc = $mailer->mail(["to_address" => REG_NOTIFY_ADDRESS,
"subject" => "Registration notice for Tiny Tiny RSS",
"message" => $reg_text]);