Hi All,
After several years of working perfectly, forms on my site stopped working recently. The hosting company has established that the mails ARE being despatched by the site, and are reaching Microsoft, where they just disappear, so that’s not a Blocs problem.
HOWEVER, the hosting company also said the following:
The pop-up subscription order form at Subscribe seems to build an email in Javascript and after digging around it seems it uses a PHP script to send out the email using the PHP Mail function. The script does not seem to save the data anywhere so if your email fails you’re out of luck. While this approach can and has worked in the past, it is not the currently recommended way to handle this. The better method is to:
Log the data locally on the server (files/database/etc.).
Use SMTP instead of local PHP Mail function for better security, deliverability and control.
a. Use the SMTP information from your email provider so you can send mail directly from your authorized email platform.
b. Use a service such as Sendgrid etc. for outbound mail.
That said, from what I can see the system should be working normally as far as our side is concerned. Microsoft is not delivering your email to your inbox so you will need to contact them for assistance. I would recommend whomever manages your email scripts update the form scripts to use SMTP and log the data safely before trying to send so you don’t lose your emails.
Hopefully that helps with this issue.
SO, question is, is there an easy way to switch my form scripts to STMP, or is this an option already in blocs (v5.2.6) which I have not found/used to date?
Also, is there an option to log enquiries so that if mails disappear, these can be recovered via such a log/database? (All beyond me!)
Step-by-step answers of the “Dummy’s Guide…” variety would be appreciated.
Thanks in anticipation!
Yes, I agree with this. I recently made a from starting from an empty bloc. Uploaded the built0in php from and tested it. Needless to say it did not work. Need to find a working simple solution.
As said, once I got to grips with forms, thanks to help on this Forum, I have, until now, had no problems with them working. This problem seems to happen when the mails sent by my site arrive at Microsoft’s server, so in this regard nothing wrong with Blocs, using the PHP script.
The advice I received re. forms was basically to ensure that each form had to have a unique name, and each part of each form should have a unique name too. I use names like ‘form-contact’, and for the parts, ‘form-contact-name’, etc.
Thanks for your prompt & helpful reply.
Hadn’t realised that SMTP was a built-in option for mails! Have looked at the KB link you provided, and I can certainly work with that. It’s well presented.
That really just leaves the business of whether there is a means of adding a log, or some kind of link-up with a database, in order to to keep a record of all mails sent by the site… While this is not quite so critical, I do feel it would be a useful enhancement of the site if practical.
If needed, work with your hosting company. Do they use cPanel, it has an archive, download, etc.
Or, given they suggested SMTP the server obviously supports it, they likewise have access to said server, databases, server side scripts, etc., they should be able to assist you with things.
In the PHP file generated by Blocs (Folder includes) there is a try catch block. So in case everything worked or if something went wrong.
You can hook into this and write to a database or a text log. There are also various debug options in PHPMailer, you can specify a function there. If you attach yourself there, everything can go into a log. Depending on the level, the log then contains everything from the contact recording to the other server to the sending. Ideal if you need proof. Works perfect…
@BLOCS-Freak, That is indeed true, if a user is comfortable doing so. I assumed most users are not interested and instead averse to most things code related.
Just for nostalgia, the SMTP feature started with this
It was then added in Blocs Blocs 5.1.0 - July 3rd 2023 - Added SMTP form posting support
Again, if required @Hawkeye your hosting compnay should be able to assist you with any approach you wish to take.
An update: it turns out that the problem encountered in my initial forum post here was caused by Microsoft having introduced updated phishing protections on the site which were blocking the e-mails generated by the Blocs PHP forms.It was resolved when Microsoft support agreed to remove the newly introduced phishing protections for this site. I am meantime still waiting for the required information from my client to update all the forms on the site to SMTP…
Just thought that it may be helpful to post this “solution” in case others have encountered the same problem.