No longer receiving form submission emails
Autor: Ryan M.I have 2 forms on my site, that upon submission, I receive an email with the contents entered in the form. I am no longer receiving the email from these form submissions. The last one I received was about 2 months ago. This site was created using version 17.0.4. I was able to find the following message in a log:
[31-Oct-2019 20:20:43 UTC] PHP Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /home4/contites/public_html/res/PHPMailerAutoload.php on line 45
I've upgraded to version 2019.2.9, imported my project into it, exported the site, and uploaded to the server. However, I'm still not receiving the emails. There are no errors that appear in the browser. Any thoughts on what to try next?
I see that the PHPMailerAutoload.php file is quite different between the 2 version. The later version only contains the following:
<?php
require_once("class.phpmailer.php");
require_once("class.smtp.php");
require_once("class.exception.php");
Is this correct? URL: contitesting.com
Hello Ryan,
Yes, the contents of that file are correct.
There are many different and wildly varied reasons for email non-delivery. Your issue might well turn out not to be related to PHP at all, but as a precaution check that the version of PHP installed on your server is 5.6 or newer.
Before proceeding any further can you confirm what you have entered in Step 5 > Export > Upload the Website to Internet, in the field marked WebSite Address (URL)?
I believe this is currently set to http://localhost - if so, that is wrong... it should be set to your fully qualified domain name, as follows:
https://contitesting.com/
The value entered in that field has a major bearing on many features within WebSite X5, and this error alone could be the reason for your problem. If you continue to experience difficulty please let us know.
Kind regards,
Paul
Search the WebSite X5 Help Center
Autor
I actually use the 'Export the Website to disk' option in Step 5, and then upload to the server using an FTP client. I see this option also has the 'Website Address' field and it does default to localhost. Should I change it here as well to be https://contitesting.com/?
Yes, absolutely!
Please be aware that using a third party FTP client to transfer the files to the server results in some reduced functionality when using WebSite X5. However, I don't think this has any bearing on your current email issue.
Autor
I've made the URL change in the export and uploaded to the server, but the emails still arent coming through.
PHP version on the server is 7.2.7.
I'm seeing this error in a log:
[04-Nov-2019 05:06:38 UTC] PHP Fatal error: Class 'PHPMailer\PHPMailer\PHPMailer' not found in /home4/contites/public_html/res/x5engine.php on line 5438
However, this is what's showing in the x5engine.php file on line 5438.
/*
|--------------
| PHPMailer
|--------------
*/
if ($this->emailType == 'phpmailer') {
$email = new PHPMailer(false);
// SMTP support
if ($this->use_smtp) {
$email->isSMTP();
$email->Host = $this->smtp_host;
$email->Port = $this->smtp_port;
if ($this->smtp_encryption != 'none') {
$email->SMTPSecure = $this->smtp_encryption;
}
$email->SMTPAuth = $this->use_smtp_auth;
if ($this->use_smtp_auth) {
$email->Username = $this->smtp_username;
$email->Password = $this->smtp_password;
}
}
// Meta
$email->CharSet = 'UTF-8'; // WSXELE-1067: Force UTF-8
$email->Subject = $subject;
$email->From = addressFromEmail($from);
$email->FromName = nameFromEmail($from);
// WSXELE-1120: Split the email addresses if necessary
$to = str_replace(";", ",", $to); // Make sure it works for both "," and ";" separators
foreach (explode(",", $to) as $addr) {
// WSXELE-1157: Provide support for the format John Doe <***>
$email->addAddress(addressFromEmail($addr), nameFromEmail($addr));
}
// Content
$email->isHTML(true);
$email->Body = $this->header . $this->styleHTML($html) . $this->footer;
$email->AltBody = $text;
// Attachments
foreach ($attachments as $file) {
if (isset($file['name']) && isset($file['content']) && isset($file['mime'])) {
$email->addStringAttachment($file['content'], $file['name'], 'base64', $file['mime'], 'attachment');
}
}
if (!$email->send()) {
$this->registerLog($email->ErrorInfo);
return false;
}
return true;
}
I've asked the Incomedia support team to take a look at this thread, Ryan, so they can follow along with us and hopefully speed a resolution for you.
In the meantime, I've thought about this at some length, and my own conclusion is still that the WebSite X5 software is struggling on account of incorrect file paths and/or possibly file or directory permissions.
At this point I would ask you if it's possible to use the built-in FTP engine within WebSite X5 to do a complete and full upload to the server, overwriting any existing files which may already be present there.
When using the integral FTP engine you can be assured that WebSite X5 will set the directory structure up correctly on the server, with the appropriate and necessary permissions on all files and folders.
Before uploading to the server from within WebSite X5 you should first hold down the CTRL key whilst entering the Preview mode: this will ensure there are no inconsistencies left behind from previous uploads, when your WebSite Address (URL) was set to localhost.
Hello Ryan
Paul could indeed be on the right track about it. I would suggest proceeding as he advised as well. If that doesn't solve it, we can move on to further analysis.
"At this point, I would ask you if it's possible to use the built-in FTP engine within WebSite X5 to do a complete and full upload to the server"
Please do delete the content currently uploaded on your server and perform a full upload of the website through the software.
It should then be able to find all the files and elements it needs:
Try this out and keep us posted here
Thank you
Stefano
Autor
After thinking about it, I believe the PHP error that I posted above was due to me swapping in an older version of the PHPMailerAutoload.php file. Once I switched it back to the correct one, there are not any new errors showing in the log.
I've uploaded the site via the built-in FTP, overwriting the existing files, but emails still aren't showing up. There are no errors that I'm seeing either.
Another aspect of this is that, when it did work, the emails came into my Junk folder. I guess it's possible that something could have changed there that now they're being blocked completely, maybe? I'm not sure where I can look to see if emails have been blocked or what address I need to whitelist.
Are you attempting to send email from your own domain, e.g. emailaddress_at_contitesting.com
Or are you using a third party email provider, such as Google Gmail or Yahoo?
Autor
I'm not actually sure where the emails are coming from. I guess whatever Hostmonster uses to handle this type of email functionality. I can provide the header information from past emails that I've received if that would help.
In X5, it's set to send the emails to my 3rd party email address... @outlook.com
Check what you have entered (if anything) in the field shown below at Step 1 Settings > Advanced > Data Management
Emails can often be marked as spam, or blocked completely, if they are seen to be sent from a different domain to that on which a website is hosted.
See this extract from the WebSite X5 help file:
▪Always use the following sender address: if this option is enabled, it sets the e-mail address indicated in the field as the sender of all the e-mails that leave the website. This e-mail address overwrites the e-mail address given in the options of the Contact Form Object, that of the customer placing an order through the e-commerce shopping cart and, in the Pro edition, that of the user who automatically registers to access a Members' Area in the website.
This option is useful if the provider blocks e-mails from the server that are sent by a user whose domain is different from this website: for example, an e-mail for an order from www.mywebsite.com will not be sent if the sender's address is notsomething_at_mywebsite.com. In these cases, the problem can be solved by specifying a sender's e-mail address that has the same domain name as the website from which the e-mail leaves.
Autor
Currently, that field is not populated. Should I try using a domain email address in there?
Autor
I went ahead and made that change and that solves it. The emails are now coming through. Thanks for all the help!!!
Yes, that would be a useful troubleshooting tool, and can't do any harm.
Try entering an email address such as ryan_at_contitesting.com (obviously you will have to enter the address in the correct format with the 'at' symbol (@) - we can't do this on the forum as email addresses are edited out in posts)
Once you have reuploaded your site to the server and sent a test message, then you should be able to track its progress using the 'Track Delivery' feature if you have cPanel on your server. If not using cPanel you may have a similar feature for email tracking/email logs.
You can also try changing the Email form script type in Step 1 Settings > Advanced > Data Management > E-mail... reuploading your site to the server after each change, and sending a fresh test message using the Contact Form.
My apologies Ryan, you must have sent your last message whilst I was composing my reply.
Anyway, that's brilliant news that it's sorted!
All the best...