game/_incl_data/class/Helper/Mail.php

37 lines
1.0 KiB
PHP
Raw Normal View History

<?php
namespace Helper;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPMailer;
class Mail
{
public static function send($to, $message, $subject = 'Бойцовский клуб'): int
{
$mail = new PHPMailer;
try {
$mail->IsSMTP();
$mail->Host = 'smtp.mail.yahoo.com';
$mail->SMTPAuth = true;
$mail->Username = 'newcombats@yahoo.com';
$mail->Password = 'uqcdbnsoagxcyysh';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->CharSet = 'UTF-8';
$mail->setFrom('newcombats@yahoo.com', 'Бойцовский Клуб');
$mail->addAddress($to); // Add a recipient
$mail->IsHTML();
$mail->Subject = $subject;
$mail->Body = '<div>' . $message . '</div>';
$mail->AltBody = $message;
$mail->send();
return 1;
} catch (Exception $e) {
return 0;
}
}
}