Forum
Form email notifications not working
I can't get form email notifications working on a staging server. The email notifications work fine locally with Gmail credentials in config.php
, but they fail on staging.
Both locally and in staging the email test in perch settings succeeds. I've also tried scrapping the gmail credentials and installing exim4 on the ubuntu staging server but the problem persists; mail test works, form email notifications don't.
I would suggest testing using something like Mailtrap.
https://solutions.grabaperch.com/development/email-testing-with-mailtrap
Testing with Mailtrap mirrors the same problem I'm experiencing with real email credentials:
locally
settings > email > test email settings : success
apps > forms > form responses > send response via email: success
staging
settings > email > test email settings : success
apps > forms > form responses > send response via email: fail
Is there something different about the way Perch sends form entries via email vs the email test settings?
What is happening when you say it fails?
Form entry is stored in the database and viewable via apps > forms, but email does not send.
Have you checked your mail logs to see if there is an error?
No errors in the exim4 log - form entries are not being added to the queue
Can you turn on debug and try again - what does it output?
Ah, I didn't realize
<?php PerchUtil::output_debug(); ?>
existed.On the server I was receiving an
Invalid Address:
error when the email address set inconfig.php
didn't match the 'Send from address' field in the forms app. Updating it to the same address fixed my issue.Is it possible to have the 'Send from address' be different than the address in
config.php
? Seems as though if not (as I've experienced), it shouldn't be an option in the forms app.Thanks for your prompt support as always.
Yes, it should be possible. Can you show me the output you're getting?
Ok, so
Brad
is clearly not a valid email address. What value are you setting?Yes, well aware :)
The email set in config.php and the email set in form options were different, but both were valid addresses and I don't remember which was which. They were either one of the following:
domain.com@gmail.com website@domain.com
The form options have a setting for what to use in the From header - it's "Send from address"