Answer the question
In order to leave comments, you need to log in
How to upload PHPMAILER to Wordpress?
The script works on local (without vp), started transferring to the site, gives an error, by debug it gave this (Changed ports)
2019-12-13 16:24:21 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP t27sm5175832ljd.26 - gsmtp
2019-12-13 16:24:21 CLIENT -> SERVER: EHLO a0368236.xsph.ru
2019- 12-13 16:24:21 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2a0a:2b42:41:5b75::]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250
2019-12-13 16:24:21 CLIENT -> SERVER: STARTTLS 2019-12-13
16:24:21 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
-> SERVER: EHLO a0368236.xsph.ru
2019-12-13 16:24:21 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2a0a:2b42:41:5b75::]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN- CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2019-12-13 16:24:21 CLIENT -> SERVER: AUTH LOGIN
2019-12-13 16:24:21 SERVER -> CLIENT: 334
VXNlcm2hb2hb5 :24:21 CLIENT -> SERVER: c2hnLml2YW45N0BnbWFpbC5jb20=
2019-12-13 16:24:21 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2019-12-13 16:24:21 CLIENT -> SERVER:
M1owMElwTWIjUSVnX1dl :24:21 SERVER -> CLIENT: 534-5.7.14 534-5.7.14 Please log in via your web browser and then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google. com/mail/answer/78754t27sm5175832ljd.26 - gsmtp
2019-12-13 16:24:21 SMTP ERROR: Password command failed: 534-5.7.14 534-5.7.14 Please log in via your web browser and then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 t27sm5175832ljd.26 - gsmtp
SMTP Error: Could not authenticate.
2019-12-13 16:24:21 CLIENT -> SERVER
:
QUIT https://github.com/PHPMailer/PHPMailer/wiki/Troubl...
Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubl...
$(function(){
$('#ajax_form').submit(function(){
var data = $('#ajax_form').serialize();
$.ajax({
url: '/wp-content/themes/electric/mail.php',
type: 'POST',
data: data,
success: function(res) {
}
})
return false
})
});
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'tyt_moi_password';
$mail->Port = 587;
$mail->SMTPDebug = 2;
$mail->From = '[email protected]';
$mail->FromName = 'DvaBro';
$mail->addAddress('[email protected]');
$mail->isHTML(true);
$mail->Subject = 'Новая заявка с сайта DvaBro';
$mail->Body = "Имя: {$_POST['name']}<br>Фамилия: {$_POST['surname']}";
$mail->AltBody = Имя: {$_POST['name']}\r\nФамилия: {$_POST['surname']};
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
Answer the question
In order to leave comments, you need to log in
It seems like WordPress already has a PHPMailer class and it works in wp_mail(), so you get an error
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question