",
'Reply-To: ' . $replyTo,
];
if (!empty($options['cc'])) {
$headers[] = 'Cc: ' . $options['cc'];
}
if (!empty($options['bcc'])) {
$headers[] = 'Bcc: ' . $options['bcc'];
}
$sendmailPath = ini_get('sendmail_path');
$transportAvailable = true;
if (stripos(PHP_OS, 'WIN') !== 0) {
$binary = trim(strtok((string) $sendmailPath, ' '));
if ($binary && !is_executable($binary)) {
$transportAvailable = false;
}
}
if (!$transportAvailable) {
return false;
}
$additionalHeaders = implode("\r\n", $headers);
$encodedSubject = function_exists('mb_encode_mimeheader')
? mb_encode_mimeheader($subject, 'UTF-8')
: $subject;
return @mail($to, $encodedSubject, $htmlBody, $additionalHeaders);
}
}