Joywork/mailtest.php
2026-05-22 21:21:54 +03:00

63 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
require_once($_SERVER['DOCUMENT_ROOT']."/engine/functions.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/engine/mailer/PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->From = "robot@joywork.ru";
$mail->FromName = "JoyWork.ru";
$mail->Username = "robot@joywork.ru";
$mail->Password = '6@tMRdQbJbllKz#Y';
$mail->Port = 465;
$mail->Host = 'smtp.yandex.ru';
$mail->SMTPSecure = 'ssl';
$mail->SMTPDebug = 3; // функция с параметром test используется в настройках почты
$mail->isHTML(true);
$mail->AddCustomHeader('Date: ' . date("D, d M y H:i:s O") . ';');
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->CharSet = "utf-8";
$mail->addAddress("andrei.lav@mail.ru");
$mail->Subject = "Покупка меда";
$mail->Body = "Добрый день";
$mail->AltBody = "Это письмо сгенерировано в формате HTML. Ваш клиент не поддерживает HTML или эта функция выключена.";
$mail->ClearAttachments();
if ($mail->Send()) {
return true;
} else {
return $mail->ErrorInfo;
}