Forum

Thread tagged as: Problem, Addons, Forms

Perch Forms Not Being Emailed

Hi all,

I was just wondering if anyone else was having issues with Perch Forms submissions not being emailed?

When I send a test email from Perch admin in settings, it works straight away no problem and I receive the email. But just recently emails from Perch Forms seem to have stopped working.

I've even turned off our spam filter to see if that worked but unfortunately, it made no difference.

I've also tried using different to and from email addresses, but again no luck

And it's not just me, other clients and our freelance developers are having the same problem too.

Many thanks

Perch: 3.0.10, PHP: 7.0.22, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_blog (5.6.1), perch_forms (1.9), chirp_seo (1.1)
App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_forms', 'chirp_seo' ];
PERCH_LOGINPATH: /cms
PERCH_PATH: /home/plant/U0MA6EL3/htdocs/cms
PERCH_CORE: /home/plant/U0MA6EL3/htdocs/cms/core
PERCH_RESFILEPATH: /home/plant/U0MA6EL3/htdocs/cms/resources
Image manipulation: GD Imagick
PHP limits: Max upload 128M, Max POST 128M, Memory: 256M, Total max file upload: 128M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: globalplantgenetics.com
DOCUMENT_ROOT: /home/plant/U0MA6EL3/htdocs/
REQUEST_URI: /cms/core/settings/diagnostics/
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
Glen Piggott

Glen Piggott 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are they not being sent, or not being received?

Drew McLellan said:

Are they not being sent, or not being received?

Not entirely sure - how would I find out?

I would guess at not being sent as we've tried sending to several different email addresses (on different mail servers) and also from several email addresses and no of them have worked.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You could try sending them to something like Mailtrap https://mailtrap.io

Also, if you turn on debug you can see emails being sent.

Simon Clay

Simon Clay 127 points

I often find it's the 'Send from address' in the Form Settings that makes a difference.

Depending on the server, what you put into that field determines whether it reaches it's destination or not.

Where possible I like to have the ID of the field in the form for the Send from address e.g.: {email}

Other times an email address with the same domain as the website for the Send from address e.g.: website@my-website-domain.com

Getting somewhere, I'm getting Could not instantiate mail function.

Debug Message - Perch 3.0.8
[30] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT * FROM perch3_forms WHERE formKey='ContactPageForm' LIMIT 1
[1] SELECT * FROM perch3_pages WHERE pagePath='/contact-us.php' LIMIT 1
Array
(
    [fields] => Array
        (
        )

    [files] => Array
        (
        )

    [page] => Array
        (
            [id] => 11
            [title] => Contact us
            [path] => /contact-us.php
            [navtext] => Contact us
        )

)
Building message with Dollar template
Could not instantiate mail function.
Using email template: /home/angliait/D14J5RSQ/htdocs/townaround/cms/core/emails/.txt (txt)
Building message with Dollar template
Could not instantiate mail function.
Could not instantiate mail function.
INSERT INTO perch3_forms_responses(responseJSON,formID,responseIP,responseSpamData) VALUES('{\"fields\":{\"name\":{\"attributes\":{\"type\":\"text\",\"class\":\"form-control type-text\",\"id\":\"name\",\"placeholder\":\"Name\",\"label\":\"name\"},\"value\":\"Glen Piggott\"},\"phone\":{\"attributes\":{\"type\":\"text\",\"class\":\"form-control type-text\",\"id\":\"phone\",\"placeholder\":\"Phone\",\"label\":\"phone\"},\"value\":\"01553633010\"},\"email\":{\"attributes\":{\"type\":\"text\",\"class\":\"form-control type-text\",\"id\":\"email\",\"placeholder\":\"Email Address\",\"label\":\"email\"},\"value\":\"glen.piggott@soundwave.co.uk\"},\"help\":{\"attributes\":{\"type\":\"text\",\"class\":\"form-control type-text\",\"id\":\"help\",\"placeholder\":\"How can we help?\",\"label\":\"how can we help?\"},\"value\":\"testing\"}},\"files\":[],\"page\":{\"id\":\"11\",\"title\":\"Contact us\",\"path\":\"\\/contact-us.php\",\"navtext\":\"Contact us\"}}','4','87.127.197.165','{\"fields\":[],\"environment\":{\"REDIRECT_UNIQUE_ID\":\"WcJ4X1PfagsAADbwYb0AAAAJ\",\"REDIRECT_HANDLER\":\"application\\/x-httpd-php70\",\"REDIRECT_STATUS\":\"200\",\"UNIQUE_ID\":\"WcJ4X1PfagsAADbwYb0AAAAJ\",\"HTTP_HOST\":\"dev.townandaround.net\",\"HTTP_CONNECTION\":\"keep-alive\",\"CONTENT_LENGTH\":\"231\",\"HTTP_CACHE_CONTROL\":\"max-age=0\",\"HTTP_ORIGIN\":\"https:\\/\\/dev.townandaround.net\",\"HTTP_UPGRADE_INSECURE_REQUESTS\":\"1\",\"CONTENT_TYPE\":\"application\\/x-www-form-urlencoded\",\"HTTP_USER_AGENT\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/61.0.3163.91 Safari\\/537.36\",\"HTTP_ACCEPT\":\"text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8\",\"HTTP_REFERER\":\"https:\\/\\/dev.townandaround.net\\/contact-us\",\"HTTP_ACCEPT_ENCODING\":\"gzip, deflate\",\"HTTP_ACCEPT_LANGUAGE\":\"en-GB,en;q=0.8\",\"HTTP_COOKIE\":\"PHPSESSID=nil0h30otar1h2eu9umt30t0p7; cmsa=1; _ga=GA1.2.137214708.1497437586; _gid=GA1.2.1939868731.1505916048\",\"PATH\":\"\\/usr\\/lib64\\/qt-3.3\\/bin:\\/usr\\/local\\/sbin:\\/usr\\/local\\/bin:\\/sbin:\\/bin:\\/usr\\/sbin:\\/usr\\/bin:\\/usr\\/bpweb\\/bin:\\/root\\/bin\",\"SERVER_SIGNATURE\":\"<address>Apache Server at dev.townandaround.net Port 80<\\/address>\\n\",\"SERVER_SOFTWARE\":\"Apache\",\"SERVER_NAME\":\"dev.townandaround.net\",\"SERVER_ADDR\":\"83.223.106.11\",\"SERVER_PORT\":\"80\",\"REMOTE_ADDR\":\"87.127.197.165\",\"DOCUMENT_ROOT\":\"\\/home\\/angliait\\/D14J5RSQ\\/htdocs\\/townaround\\/\",\"SERVER_ADMIN\":\"postmaster@dev.townandaround.net\",\"SCRIPT_FILENAME\":\"\\/home\\/angliait\\/D14J5RSQ\\/htdocs\\/townaround\\/contact-us.php\",\"REMOTE_PORT\":\"53066\",\"REDIRECT_URL\":\"\\/contact-us.php\",\"GATEWAY_INTERFACE\":\"CGI\\/1.1\",\"SERVER_PROTOCOL\":\"HTTP\\/1.1\",\"REQUEST_METHOD\":\"POST\",\"QUERY_STRING\":\"\",\"REQUEST_URI\":\"\\/contact-us.php\",\"SCRIPT_NAME\":\"\\/contact-us.php\",\"ORIG_SCRIPT_FILENAME\":\"\\/usr\\/local\\/php70\\/bin\\/cgi\\/php-cgi\",\"ORIG_PATH_INFO\":\"\\/contact-us.php\",\"ORIG_PATH_TRANSLATED\":\"\\/home\\/angliait\\/D14J5RSQ\\/htdocs\\/townaround\\/contact-us.php\",\"ORIG_SCRIPT_NAME\":\"\\/php70-cgi\\/php-cgi\",\"PHP_SELF\":\"\\/contact-us.php\",\"REQUEST_TIME_FLOAT\":1505917023.3175,\"REQUEST_TIME\":1505917023,\"argv\":[],\"argc\":0}}')
[1] SELECT * FROM perch3_forms_responses WHERE responseID='32' LIMIT 1
No ids to log.
Using template: /templates/search/search-form.html
[8] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/contact-us.php' OR regionPage='*' ORDER BY regionPage DESC
Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like your SMTP settings are incorrect.

Drew McLellan said:

It looks like your SMTP settings are incorrect.

Sorry Drew, just edited the post above as now getting Could not instantiate mail function.

The test email via settings comes through fine

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, how I can I help with this?

Help me to fix why no emails are being sent from Perch Forms!

Simon Clay

Simon Clay 127 points

Hi Glen,

When you receive your test email, what address is it from? If you add that email address to 'Send from address' in the Form Options does the form submit successfully?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like the software is attempting to send but the server isn't correctly configured. What does your server admin say about this?

Interesting.

Thanks Simon, if I change the email from address to mine it works, yet turning it back I get the Could not instantiate mail function. error in debug.

We run nearly 30 Perch websites on our server and have never had this issue before which is why I've come here first rather than ask our server support.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the difference between this and the 29 others that are working?

Nothing as far as I'm aware - I normally set the form email from address as the client's general email address like info@ or enquiries@ in case the customer directly replies to the email,

Simon Clay

Simon Clay 127 points

Hi Glen, yes, it's odd if you've not had the issue before on the same server.

What do you have the email from address as: a dynamic ID from the form itself e.g. {email} , or a fixed email address? ah - I see you've just answered that.

Can you try a dynamic ID from the form itself e.g. {email} ? In which case it would come from the person who filled out the form's email.

A few bits of info here re the error message: https://docs.mailpoet.com/article/56-could-not-instantiate-mail-function

I have a similar number of Perch sites to you (on differen servers) and have had similar issues and been able to resolve them by changing the email from address, but for the first time last week I had to add this to my perch/config/config.php file to make it work:

define('PERCH_EMAIL_METHOD', 'smtp');
define('PERCH_EMAIL_HOST', 'senders.mail.host');
define('PERCH_EMAIL_SECURE', 'tls');
define('PERCH_EMAIL_AUTH', true);
define('PERCH_EMAIL_PORT', 25);
define('PERCH_EMAIL_USERNAME', 'senders.username.co.uk');
define('PERCH_EMAIL_PASSWORD', 'senders-email-password');

Which was the only thing that worked in this instance. It basically uses the clients mail server to send the form data.

As described here: https://docs.grabaperch.com/perch/configuration/email/

But in my mind, if the client changed their email password (unlikely, but possible), this would stop working.

Thanks Simon

I've just changed the PERCH_EMAIL_FROM and PERCH_EMAIL_FROM_NAME in config.php from mine (from when first setting up Perch) with the client's and then matched that in the email from address on the form options and it's worked.

Strange one