2022-12-19 18:26:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Core;
|
|
|
|
|
|
|
|
use PHPMailer;
|
|
|
|
|
|
|
|
class Mail
|
|
|
|
{
|
2023-01-10 16:29:32 +00:00
|
|
|
public static function send($to, $message, $subject = 'Бойцовский клуб')
|
2022-12-19 18:26:14 +00:00
|
|
|
{
|
|
|
|
require dirname(__DIR__) . '/mail/class.phpmailer.php';
|
|
|
|
$mail = new PHPMailer;
|
|
|
|
|
|
|
|
$mail->IsSMTP(); // Set mailer to use SMTP
|
|
|
|
$mail->Host = 'smtp.mail.yahoo.com'; // Specify main and backup server
|
|
|
|
$mail->SMTPAuth = true; // Enable SMTP authentication
|
|
|
|
$mail->Username = 'newcombats@yahoo.com'; // SMTP username
|
|
|
|
$mail->Password = 'uqcdbnsoagxcyysh';
|
|
|
|
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
|
|
|
|
$mail->Port = 587;
|
|
|
|
$mail->CharSet = 'UTF-8';
|
|
|
|
|
|
|
|
$mail->From = 'newcombats@yahoo.com';
|
2023-01-10 17:26:14 +00:00
|
|
|
$mail->FromName = 'Бойцовский Клуб';
|
2022-12-19 18:26:14 +00:00
|
|
|
$mail->AddAddress($to); // Add a recipient
|
|
|
|
|
|
|
|
$mail->IsHTML(true); // Set email format to HTML
|
|
|
|
|
|
|
|
$mail->Subject = $subject;
|
|
|
|
$mail->Body = '<div>' . $message . '</div>';
|
|
|
|
$mail->AltBody = $message;
|
|
|
|
|
|
|
|
if (!$mail->Send()) {
|
|
|
|
return 'Message could not be sent. Mailer Error: ' . $mail->ErrorInfo;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|