SMTP Mailer Issue

5 replies · opened Apr 19, 2020

DDanielApr 19, 2020

I have been able to successfully send mail with PHPMailer tutorial code like this...

isSMTP();
//Enable SMTP debugging

$mail->SMTPAuth = true;
$mail->SMTPDebug = 2;
$mail->Host = 'ssl://smtp.yandex.ru';
$mail->Port = 465;
$mail->Username = 'EDITED';
$mail->Password = 'EDITED';
//Set the hostname of the mail server

//Set the SMTP port number - likely to be 25, 465 or 587

//Whether to use SMTP authentication

//Username to use for SMTP authentication

//Password to use for SMTP authentication

//Set who the message is to be sent from
$mail->setFrom('EDITED', 'Daniel');
//Set an alternative reply-to address
$mail->addAddress('EDITED', 'Daniel');
//Set who the message is to be sent to
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
$mail->Body = 'This is a plain-text message body';

//send the message, check for errors
if (!$mail->send()) {
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message sent!';
}
?>

Unfortunately, none of the contact forms work that I upload to my site... with or without recaptcha (Recaptcha displays and is solved correctly).
https://withdaniel.ru (Message in footer)
or
https://withdaniel.ru/contact-2.html (It turns grey and nothing happens. Just an example. Not going to use)

I'm guessing form.php needs to be updated to work with newer PHPMailer?

DDanielApr 19, 2020

To clarify, the Canvas code works if I use PHP mailing (nonsmtp).

SSemicolon WebSTAFFApr 19, 2020

Hello,

The Form Processor (include/form.php) included with Canvas is designed to be Future Proof. So even if you update the PHPMailer to the Latest Version by yourself, it will still work perfectly fine. The issue with your code is this line: $mail->SMTPDebug = 2;. Replacing this with $mail->SMTPDebug = 0; will automatically fix your issue. This code has already been provided in the Documentation > Forms Section and your Forms would have worked in the first try.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

DDanielApr 19, 2020

Thanks for the help. I've changed it back to $mail->SMTPDebug = 0; Still no luck. I click submit and the form turns grey. I run https://withdaniel.ru/test.php (with the debug code 2 or 0) and it works.

DDanielApr 19, 2020

Nevermind! You got it. Sorry I must've missed something. Thanks guys! Will definitely do business in the future and look at your other projects.

SSemicolon WebSTAFFApr 19, 2020

Hello,

We have just tried submitting the Forms through our development files, and the we can see your include/form.php is returning an error after a Timeout (attached screenshot). You can try this yourself, by simply adding the .customjs Class to the .form-widget Element and then try submitting the Form again.

After reviewing your code again, we noticed that your Hostname included SSL. Instead of including SSL, try the following code:


$mail->Host = 'smtp.yandex.ru';
$mail->SMTPSecure = 'ssl';

Hope this Helps!

Let us know if you are still facing any further issues with this.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard