Hi everyone, sorry about this but I have been working to diagnose this for hours and have made no progress.
I have a basic form using the form component from Elements. The hosting platform is ionos.co.uk. I have the SMTP host, username and password set correctly - tested with the SMTP Tester Pro app.
The logs keep saying:
form_config.ERROR: EmailService: Exception in sendFormSubmission {“error”:“SMTP Error: Could not connect to SMTP host.”,“exception”:“[object] (PHPMailer\PHPMailer\Exception(code: 0): SMTP Error: Could not connect to SMTP host. at /homepages/17/d4299101015/htdocs/rw/elements/com.realmac.corepack/api/vendor/phpmailer/phpmailer/src/PHPMailer.php:2348)”
The fact it works in SMTP Tester Pro is a bit of a red herring, as that’s running on your Mac, not on the IONOS server.
That said, because it works in Tester Pro, it does confirm the form itself is set up correctly and behaving as expected
So far, so good.
Because it fails only when running on your server, this strongly points to a server-side configuration issue. Some shared hosts block outbound connections to mail ports 25 / 465 / 587 unless you use their own mail servers or enable specific settings. In some cases, those ports are blocked entirely by default.
The best next step is to contact IONOS support and explain that you’re trying to send email from a PHP-based form, then ask them for the exact SMTP details and requirements for outbound mail from your hosting package.
I don’t seem to have a htaccess file on the server, I am using FileZilla Pro to upload via SFTP. I asked IONOS suppport about the lack of a default htaccess file in the same ticket I opened at Dan’s suggestion.
Do you have the site published with the non-working contact form? If so, can you link us to the page, as well as send over your project file via Elements Cloud (redacting your email account password form the form settings beforehand) so we can take a look?
But yes wait for IONOS to get back to you with the correct SMTP details you should be using, also making sure they haven’t blocked any outgoing SMTP ports on your hosting account, just to make sure that’s all squared away before further testing.
IONOS have said that because it is a basic HTML site, it is the developers issue to solve and just confirmed that smtp traffic should be sent to the destination that I have used in the form. I will create a temporary copy of the project file with the password missing and send it over as you have suggested.