Forum

Thread tagged as: Problem, Configuration, Hosting

Sending email via PHP?

I have tested sending email successfully on my server (Mediatemple) using PHP's mail() functionality but I cannot seem to get Perch to send email.

I have set the mail parameter in the config: define('PERCH_EMAIL_METHOD', 'mail'); and PERCH_EMAIL_FROM and PERCH_EMAIL_FROM_NAME.

I know you cannot reproduce this but just wanted to check I wasn't missing something from here: https://docs.grabaperch.com/perch/configuration/email/

I was presuming that because my server could successfully send via mail(), that using define('PERCH_EMAIL_METHOD', 'mail') would suffice but alas not... does Perch use mail() or something else?

I've messaged my host provider too but just thought I'd post here in case I was missing something obvious.

Also, what is the 'sendmail' method?

Health check

PHP 7.0.6 is up to date MySQL 5.6.31-77.0 is up to date Image processing available

Summary information

Perch: 3.0.4, PHP: 7.0.6, MySQL: 5.5.53, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (3.0.4), assets (3.0.4), categories (3.0.4) App runtimes: <?php $apps_list = [ ]; PERCH_LOGINPATH: /perch PERCH_PATH: /nfs/c01/h03/mnt/44482/domains/camolab.com/html/perch PERCH_CORE: /nfs/c01/h03/mnt/44482/domains/camolab.com/html/perch/core PERCH_RESFILEPATH: /nfs/c01/h03/mnt/44482/domains/camolab.com/html/perch/resources Image manipulation: GD PHP limits: Max upload 99M, Max POST 99M, Memory: 99M, Total max file upload: 99M F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7 Resource folder writeable: Yes HTTP_HOST: camolab.com DOCUMENT_ROOT: /home/44482/domains/camolab.com/html REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Keir Moffatt

Keir Moffatt 0 points

  • 4 years ago

Ah, PERCH_EMAIL_FROM needed to be the hosting 'system' email address in order to have permission to send.

Hi Keir

As a side note, I've found increasingly that cloud-based hosting systems are blocking form submissions if the "from" email is not hosted on the same server cluster. It's a real pain in the neck when many of my clients are using 365 or Gmail to host their email. Form submissions never arrive.

It's often easier to use an SMTP workaround than rely on php mail. One host, Vidahost, recently told me not to expect mail to arrive if sent through php mail. They gave me an SMTP workaround. Your host might also have a generic SMTP server you can use from inside the server cluster.

Kind regards,

Jon

Thanks for that heads-up, Jon - I think it is probably a more robust solution to use SMTP via Gmail or an email address set up with the server itself.