isSMTP();
$mail->Host = 'localhost';
$mail->SMTPAuth = false;
$mail->Port = 25;
$mail->CharSet = 'UTF-8';
$mail->setLanguage('hu');
$mail->XMailer = false;
unset($mail->Headers['X-Mailer']);
$mail->Mailer = 'smtp';
$mail->setFrom('szaturnusz@szatuna.hu', 'Szatuna Kft');
$mail->addReplyTo('kapcsolat@szatuna.hu', 'Szatuna Kft');
$templatePath = __DIR__ . '/template/mail.html';
if (!file_exists($templatePath)) {
return ['success'=>false,'message'=>'Sablon nem található: '.$templatePath];
}
$html_template = file_get_contents($templatePath);
$html_body = str_replace('{{SUBJECT}}', $subject, $html_template);
$localIP = trim(shell_exec('hostname -I | cut -d" " -f1'));
if ($localIP == '192.168.15.10') {
$recipient_list = explode(",", $recipient_email);
for ($i=0; $i < count($recipient_list); $i++) {
$mail->addBCC(trim($recipient_list[$i]), $recipient_name);
}
$html_body = str_replace('{{CONTENT}}', $content, $html_body);
} else {
$content .= '
TEST ENVIROMENT!
- Recipient email: '.$recipient_email.'
- Recipient name: '.$recipient_name.'