Problem with mail tutorial

doh! I didn’t mean to do that. Now I have SMTP Error: Could not connect to SMTP host. Just checking it with the hosting company.

OK the hosting company are saying they have tested the SMTP settings and all is okay with the server.
they are saying it is the script.

Please post the exact error you are seeing.

{
“code”: 0,
“file”: “/var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php”,
“line”: 2052,
“message”: “SMTP Error: Could not connect to SMTP host.”,
“trace”: “#0 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php(1878): PHPMailer\PHPMailer\PHPMailer->smtpConnect()\n#1 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php(1601): PHPMailer\PHPMailer\PHPMailer->smtpSend()\n#2 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php(1437): PHPMailer\PHPMailer\PHPMailer->postSend()\n#3 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/modules/mail.php(130): PHPMailer\PHPMailer\PHPMailer->send()\n#4 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(199): modules\mail->send()\n#5 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(163): lib\App->execSteps()\n#6 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(133): lib\App->execSteps()\n#7 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(116): lib\App->exec()\n#8 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(94): lib\App->exec()\n#9 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnect/api/mail/formmailer.php(8): lib\App->define()\n#10 {main}”
}

And now this…

{
“code”: 0,
“file”: “/var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php”,
“line”: 82,
“message”: “Error parsing the JSON in define”,
“trace”: “#0 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnect/api/mail/formmailer.php(8): lib\App->define()\n#1 {main}”
}

There is a bug in the latest Wappler, get the updated file from here:

File updated, uploaded, but same issue

"code": 0,
"file": "/var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php",
"line": 82,
"message": "Error parsing the JSON in define",
"trace": "#0 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnect/api/mail/formmailer.php(8): lib\\App->define()\n#1 {main}"

The revised script still has the same error

This should be now fixed in Wappler 3.5.2 - reapply the mailer and save your server action.

reapplied thanks. but now I have an SMTP Error: Could not connect to SMTP host. I have checked with the hosting company and all is ok, all the details checked.

Ok, in order to see what exactly is wrong please open the following file in your site root:

/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php

and edit line 401 from:

public $SMTPDebug = 1;

to

public $SMTPDebug = 3;

save the file and try sending the form once again. You will see more detailed error in the console - please paste it here.

thanks Theodor

2020-11-13 11:18:52 Connection: opening to smtp.loveyurt.co.uk:25, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ),)

2020-11-13 11:18:52 Connection: opened

2020-11-13 11:18:52 SERVER -> CLIENT: 220 vps.forestyurts.com ESMTP Postfix

2020-11-13 11:18:52 CLIENT -> SERVER: EHLO loveyurt.co.uk

2020-11-13 11:18:52 SERVER -> CLIENT: 250-vps.forestyurts.com250-PIPELINING250-SIZE 10240000250-ETRN250-STARTTLS250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250-DSN250-SMTPUTF8250 CHUNKING

2020-11-13 11:18:52 CLIENT -> SERVER: STARTTLS

2020-11-13 11:18:52 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS

2020-11-13 11:18:52 Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=Plesk' did not match expected CN=smtp.loveyurt.co.uk’ [/var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php line 454]

SMTP Error: Could not connect to SMTP host.

2020-11-13 11:18:52 CLIENT -> SERVER: QUIT

2020-11-13 11:18:52 SERVER -> CLIENT:

2020-11-13 11:18:52 SMTP ERROR: QUIT command failed:

2020-11-13 11:18:52 Connection: closed

SMTP Error: Could not connect to SMTP host.

{“code”:0,“file”:"/var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php",“line”:2052,“message”:“SMTP Error: Could not connect to SMTP host.”,“trace”:"#0 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php(1878): PHPMailer\PHPMailer\PHPMailer->smtpConnect()\n#1 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php(1601): PHPMailer\PHPMailer\PHPMailer->smtpSend()\n#2 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php(1437): PHPMailer\PHPMailer\PHPMailer->postSend()\n#3 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/modules/mail.php(130): PHPMailer\PHPMailer\PHPMailer->send()\n#4 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(193): modules\mail->send()\n#5 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(157): lib\App->execSteps()\n#6 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(127): lib\App->execSteps()\n#7 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(116): lib\App->exec()\n#8 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnectLib/lib/App.php(94): lib\App->exec()\n#9 /var/www/vhosts/loveyurt.co.uk/httpdocs/dmxConnect/api/mail/formmailer.php(8): lib\App->define()\n#10 {main}"}

This is the error actually and it means your server certificate cannot be validated as it's invalid.

Send this error to your hosting and ask them to check why is the certificate invalid.

Try this update, unzip in dmxConnectLib/modules.

mail.zip (1.4 KB)

Brilliant. Thanks Theodor I will get on to them

Also please test with the file Patrick has attached, it should bypass such errors.

Thanks Patrick, I tried update still didn’t work. i will wait for the host to get back to me