PHP mail() function fails
-
Hi @M-arcus ,
I've stumbled upon similar things in the past. While the cloudron base image already does bring postfix, but due to the nature that most of the container is read-only it does not properly work. I've tried remapping all its folders but due to time constraints did not succeed.
The solution to your problem is imho to configure php to use the cloudron mailserver for sending out mails. e.g. https://www.quackit.com/php/tutorial/php_mail_configuration.cfm
-
@m-arcus said in PHP mail() function fails:
I am using the LAMP-Cloudron-Container as base.
here I was not quite sure if you're really talking about an own app. If you are indeed making an own app it may be easier to install and configure something like ssmtpd.
If you still want to look into the postfix configuration my attempts were at https://git.cloudron.io/cloudron/kopano-app/tree/postfix-test
-
@M-arcus Apps on Cloudron must use SMTP to send mail. To get the SMTP credentials you can use the following environment variables - docs:
MAIL_SMTP_SERVER= # the mail server (relay) that apps can use. this can be an IP or DNS name
MAIL_SMTP_PORT= # the mail server port. Currently, this port disables TLS and STARTTLS.
MAIL_SMTPS_PORT= # SMTPS server port.
MAIL_SMTP_USERNAME= # the username to use for authentication
MAIL_SMTP_PASSWORD= # the password to use for authentication
MAIL_FROM= # the "From" address to use
MAIL_DOMAIN= # the domain name to use for email sending (i.e username@domain)I am not a PHP developer but most of our apps use PHPmailer or the Pear mail package to send email via SMTP.
As for the error itself, this is because the PHP mail() function is configured to use the binary listed in
sendmail_path
in php.ini which is postfix/sendmail. Since Cloudron runs apps on a read-only file system, queuing it in the filesystem won't work. Even if it did work, there is nobody to send the emails from the filesystem... -
@girish Thank you for the explanation.
So you're saying sendmail is not going to work, right?
The problem is now that the application i'm installing depends on
mail()
.
I'm going have to file a merge Request or build an addon for the PHP Mailer replacement. -
That's correct, sendmail is not going to work.