Muse contact script smtp autentication

The error is too generic, we need something more specific

Replace

die(get_form_error_response($form['resources']['failed_to_send_email']));

with

die(get_form_error_response($form['resources']['failed_to_send_email']." - ".$mail->ErrorInfo));
function email_form_submission($form) {
if(!defined('PHP_EOL'))
    define('PHP_EOL', '\r\n');

$form_email = ((array_key_exists('Email', $_REQUEST) && !empty($_REQUEST['Email'])) ? cleanup_email($_REQUEST['Email']) : '');

$to = $form['email']['to'];
$subject = $form['subject'];
$message = get_email_body($subject, $form['heading'], $form['fields'], $form['resources']);
// $headers = get_email_headers($to, $form_email);    // don't need this

require 'PHPMailer-5.2.8/PHPMailerAutoload.php';  
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com'; // update this line
$mail->SMTPAuth = true;
$mail->Username = 'landinggz@gmail.com'; // update this line
$mail->Password = '.......'; // update this line
$mail->SMTPSecure = 'tls'; // leave this commented out

$mail->From = 'landinggz@gmail.com';
$mail->FromName = 'landinggz@gmail.com';
$mail->addAddress($to);
$mail->isHTML(true);

$mail->Subject = $subject;
$mail->Body = $message;

$sent = $mail->send(); 
// $sent = @mail($to, $subject, $message, $headers); // don't need this

if(!$sent)
    die(get_form_error_response($form['resources']['failed_to_send_email']." - ".$mail->ErrorInfo));

$success_data = array(
    'redirect' => $form['success_redirect']
);

echo get_form_response(true, $success_data);

}

after sending an error occurred on the server
enter link description here

This is the error you are getting
Could not send email. mail - SMTP connect () failed.

Try the following:

$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2; // set this to 0 once it is working
$mail->Host = 'smtp.gmail.com'; // update this line
$mail->Port = 587;
$mail->SMTPSecure = 'tls'; 
$mail->SMTPAuth = true;
$mail->Username = 'landinggz@gmail.com'; // update this line
$mail->Password = '.......'; // update this line
//$mail->setFrom('landinggz@gmail.com', 'landinggz@gmail.com'); // not sure if this is necessary
$mail->From = 'landinggz@gmail.com';
$mail->FromName = 'landinggz@gmail.com';
$mail->addAddress($to);
$mail->isHTML(true);

$mail->Subject = $subject;
$mail->Body = $message;

$sent = $mail->send(); 

So for the most part, I added the Debug statement and the Port.

again, an error on the server
that can that be…=(((

function email_form_submission($form) {
if(!defined('PHP_EOL'))
    define('PHP_EOL', '\r\n');

$form_email = ((array_key_exists('Email', $_REQUEST) && !empty($_REQUEST['Email'])) ? cleanup_email($_REQUEST['Email']) : '');

$to = $form['email']['to'];
$subject = $form['subject'];
$message = get_email_body($subject, $form['heading'], $form['fields'], $form['resources']);
// $headers = get_email_headers($to, $form_email);    // don't need this

require 'PHPMailer-5.2.8/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2; // set this to 0 once it is working
$mail->Host = 'smtp.gmail.com'; // update this line
$mail->Port = 587;
$mail->SMTPSecure = 'tls'; 
$mail->SMTPAuth = true;
$mail->Username = 'landinggz@gmail.com'; // update this line
$mail->Password = '........'; // update this line
//$mail->setFrom('landinggz@gmail.com', 'landinggz@gmail.com'); // not sure if this is necessary
$mail->From = 'landinggz@gmail.com';
$mail->FromName = 'landinggz@gmail.com';
$mail->addAddress($to);
$mail->isHTML(true);

$mail->Subject = $subject;
$mail->Body = $message;

$sent = $mail->send();
// $sent = @mail($to, $subject, $message, $headers); // don't need this

if(!$sent)
    die(get_form_error_response($form['resources']['failed_to_send_email']." - ".$mail->ErrorInfo));

$success_data = array(
    'redirect' => $form['success_redirect']
);

echo get_form_response(true, $success_data);

}

function get_email_headers($to_email, $form_email) {
$headers = 'From: ’ . $to_email . PHP_EOL;
$headers .= 'Reply-To: ’ . $form_email . PHP_EOL;
$headers .= ‘X-Mailer: Adobe Muse CC 2014.3.2.295 with PHP’ . PHP_EOL;
$headers .= ‘Content-type: text/html; charset=utf-8’ . PHP_EOL;

return $headers;

}
enter link description here
after sending an error occurred on the server

Seems your username/password isn’t correct

2015-08-20 12:39:15	SERVER -> CLIENT: 220 smtp.gmail.com ESMTP c5sm1175910lae.47 - gsmtp
2015-08-20 12:39:15	CLIENT -> SERVER: EHLO webingoods.com.ua
2015-08-20 12:39:15	SERVER -> CLIENT: 250-smtp.gmail.com at your service, [91.203.144.34]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2015-08-20 12:39:15	CLIENT -> SERVER: STARTTLS
2015-08-20 12:39:15	SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2015-08-20 12:39:16	CLIENT -> SERVER: EHLO webingoods.com.ua
2015-08-20 12:39:16	SERVER -> CLIENT: 250-smtp.gmail.com at your service, [91.203.144.34]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2015-08-20 12:39:16	CLIENT -> SERVER: AUTH LOGIN
2015-08-20 12:39:16	SERVER -> CLIENT: 534-5.7.9 Please log in with your web browser and then try again. Learn more at
534 5.7.9  https://support.google.com/mail/answer/78754 c5sm1175910lae.47 - gsmtp
2015-08-20 12:39:16	SMTP ERROR: Password command failed: 534-5.7.9 Please log in with your web browser and then try again. Learn more at
534 5.7.9  https://support.google.com/mail/answer/78754 c5sm1175910lae.47 - gsmtp
2015-08-20 12:39:16	CLIENT -> SERVER: QUIT
2015-08-20 12:39:16	SERVER -> CLIENT: 221 2.0.0 closing connection c5sm1175910lae.47 - gsmtp
SMTP connect() failed.
{"MusePHPFormResponse": {"success": false, "error": "Не удалось отправить сообщение эл. почты - SMTP connect() failed."}}

If you have 2 factor auth setup on your gmail account, you may want to try disabling that to see if it solves the problem.

If it does, go setup an App Password, and use that password in your script.
https://security.google.com/settings/security/apppasswords

address and password are correct
I successfully enter this data login and password in the mailbox
double is authenticated disabled
Dear friend, if I give you data hosting and password from the mailbox.
please help to solve a problem
Give me your email or contact facebook

Hi,

@cpradio - I think you maybe able to help here:

Please advise - Thank you.

Hi
@cpradio

I followed your instruction as link but for me its coming PHP error. Please help me out in this.

I have same 4 php files, i followed the same as you told. Php mailer all those thing. But same results. :frowning:

Thanks