Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. PHP mail() function fails

PHP mail() function fails

Scheduled Pinned Locked Moved Solved Support
9 Posts 3 Posters 2.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M-arcusM Offline
    M-arcusM Offline
    M-arcus
    wrote on last edited by
    #1

    I have an php app installed inside a cloudron docker container, which uses the mail() function.

    Do i need to add configuration?

    1 Reply Last reply
    0
    • M-arcusM Offline
      M-arcusM Offline
      M-arcus
      wrote on last edited by
      #2

      Error message: postdrop: warning: mail_queue_enter: create file maildrop/186514.150: Read-onlyfile system

      1 Reply Last reply
      0
      • fbartelsF Offline
        fbartelsF Offline
        fbartels
        App Dev
        wrote on last edited by
        #3

        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-arcusM 1 Reply Last reply
        0
        • fbartelsF fbartels

          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-arcusM Offline
          M-arcusM Offline
          M-arcus
          wrote on last edited by
          #4

          @fbartels Thanks you, I will try that

          I am using the LAMP-Cloudron-Container as base.

          Do you have a container on git.cloudron.io, where you did such configuration?

          fbartelsF 1 Reply Last reply
          0
          • M-arcusM M-arcus

            @fbartels Thanks you, I will try that

            I am using the LAMP-Cloudron-Container as base.

            Do you have a container on git.cloudron.io, where you did such configuration?

            fbartelsF Offline
            fbartelsF Offline
            fbartels
            App Dev
            wrote on last edited by
            #5

            @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

            1 Reply Last reply
            0
            • girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #6

              @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...

              M-arcusM 1 Reply Last reply
              0
              • girishG girish

                @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...

                M-arcusM Offline
                M-arcusM Offline
                M-arcus
                wrote on last edited by
                #7

                @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.

                1 Reply Last reply
                0
                • girishG Offline
                  girishG Offline
                  girish
                  Staff
                  wrote on last edited by
                  #8

                  That's correct, sendmail is not going to work.

                  1 Reply Last reply
                  1
                  • M-arcusM Offline
                    M-arcusM Offline
                    M-arcus
                    wrote on last edited by
                    #9

                    @fbartels @girish Thank you for the support.

                    Solution:

                    • use a SMTP mail solution
                    • sendmail (and the mail()) are not usable in current state
                    • PHPMailer could be used as an alternative
                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Bookmarks
                    • Search