game/_incl_data/mails.php
Ivor Barhansky a591872949 dev-runes (#7)
Closes #1 #2 #3 #4 #5 #6.
Под рассчёт, $150.

Co-authored-by: Ivor Barhansky <me@lopar.space>
Reviewed-on: new-combats.com/game#7
2022-06-11 11:32:31 +00:00

34 lines
1.3 KiB
PHP

<?php
/** Îòïðàâêà ïî÷òû */
function mails($to, $message, $subject = 'Áîéöîâñêèé êëóá')
{
require '_incl_data/class/mail/class.phpmailer.php';
$message = mb_convert_encoding($message, 'UTF-8', 'CP1251');
$subject = mb_convert_encoding($subject, 'UTF-8', 'CP1251');
$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';
$mail->FromName = mb_convert_encoding('Áîéöîâñêèé Êëóá', 'UTF-8', 'CP1251');
$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;
}