SMTPDebug = 3; // Enable verbose debug output $send->isSMTP(); //$send->SMTPDebug=3; // Set mailer to use SMTP $send->Host = $frommail['host']; // Specify main and backup SMTP servers // Enable SMTP authentication $send->Username = $login; // SMTP username $send->Password = $frommail['password']; if (isset($frommail['secure'])) { $send->SMTPSecure = $frommail['secure']; $send->SMTPAuth = true; } else { $mail->SMTPSecure = false; $mail->SMTPAutoTLS = false; } $send->Port = $frommail['port']; // TCP port to connect to $send->setFrom($frommail['mail'], 'Аргументы Недели'); $send->addAddress($mail, $mail); // Add a recipient $send->CharSet = 'UTF-8'; $send->isHTML(True); // Set email format to HTML $send->Subject = $subject; /*ob_start(); include 'mail.phtml'; $mailbody = ob_get_contents(); ob_end_clean();*/ $send->Body = $message; //$headers = "MIME-Version: 1.0\r\n"; //$headers .= "Content-type: text/plain; charset=utf-8\r\n"; //$headers .= "Content-Transfer-Encoding: 8bit \r\n"; //$headers .= "From: nomer@arguments.ru\r\n"; //$headers .= 'Reply-To: nomer@arguments.ru'."\r\n"; //if (mail($mail, $subject, $message, $headers)) // $status = 'OK'; //else // $status = 'NO'; if($send->send()) $status = 'OK'; else { $status = 'NO'; echo 'Mailer Error: ' . $send->ErrorInfo."\n"; } return $status; }