N
N
nyrau_v_tvorojok2020-10-03 14:28:07
PHP
nyrau_v_tvorojok, 2020-10-03 14:28:07

Language issue in form submission?

What did not add / what is not correct?

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require_once "PHPMailer/PHPMailer.php";
require_once "PHPMailer/Exception.php";
require_once "PHPMailer/SMTP.php";


    $name = $_POST['name'];
    $email = $_POST['mail'];
    $phone = $_POST['phone'];

    $mail = new PHPMailer();

    //Server settings
    $mail->isSMTP();                                            // Send using SMTP
    $mail->SetLanguage("en", 'send-message/lang/');
    $mail->SetLanguage("ru", 'send-message/lang/');
    $mail->Host       = 'smtp.mail.ru';                    // Set the SMTP server to send through
    $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
    $mail->Username   = '[email protected]';                     // SMTP username
    $mail->Password   = 'hsjsksk';                               // SMTP password
    $mail->SMTPSecure = 'ssl';         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
    $mail->Port       = 465;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

    //Recipients
    $mail->setFrom('[email protected]');
    $mail->addAddress('[email protected]');     // Add a recipient

    // Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = "Заяка с сайта!";
    $mail->Body    = "С лучшего, прекрасного, красивого сайта прилетела заяка. Кто же это?! <br>
                      $name отправил реквест <br><br>
                      Его контактная информация: $phone $email";

    if($mail->send()) {
        header('location: thank-you.html');
    } else {
        var_dump($mail->ErrorInfo);
    }


After submitting the form, this is what I get in the mail:
С ð "ññµðices, ð¿¿µðºñ °ph ° turn, ðºñ ° ð² ð½ ñ ñ¹¹ °¿¿ð ðavy ð ° ° ð ° ñºð ° ° ° °. ÐÑо же ÑÑо?!
икиÑа оÑпÑавил


What to do with these doodles?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Spartak (Web-StyleStudio), 2020-10-03
@nyrau_v_tvorojok

$mail->CharSet = PHPMailer::CHARSET_UTF8;

T
ThunderCat, 2020-10-03
@ThunderCat

$mail->CharSet = 'UTF-8';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question