PHPMailer обновлён с 5.2 до 6.8.0.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user