Cannot send email using PHP mail() function: Unable to rename '/usr/local/psa/handlers/spool/messageXXX' file: Permission denied

Follow

Comments

4 comments

  • Avatar
    Fran Le Bouleix (Edited )

    I ran into errors on CentOS7:

    libsepol.module_package_read_offsets: wrong magic number for module package:  expected 0xf97cff8f, got 0x4f44213c (No such file or directory).
    libsemanage.semanage_pipe_data: Child process /usr/libexec/selinux/hll/pp failed with code: 255. (No such file or directory).
    sendmail_rename_spool: libsepol.module_package_read_offsets: wrong magic number for module package:  expected 0xf97cff8f, got 0x4f44213c
    sendmail_rename_spool: Failed to read policy package
    libsemanage.semanage_direct_commit: Failed to compile hll files into cil files.
     (No such file or directory).
    semodule:  Failed!

     

    Here is how to use audit2allow to re-generate the module:

    1- Install audit2allow (part of setools)

     yum install policycoreutils-python

    2- Re-generate module

     egrep 'system_mail_t|httpd_sys_script_t' /var/log/audit/audit.log | audit2allow -M sendmail_rename_spool

    ******************** IMPORTANT ***********************
    To make this policy package active, execute:

    semodule -i sendmail_rename_spool.pp

    3- Run

      semodule -i sendmail_rename_spool.pp

     

    0
    Comment actions Permalink
  • Avatar
    Alexander Tsmokalyuk

    @Francoise Thank you, the article was updated.

    0
    Comment actions Permalink
  • Avatar
    Turgut Kalfaoglu

    I have a similar case but SELINUX is already disabled in /etc/sysconfig/selinux

    $subject = "deneme";
    $to_address = "testing@gmail.com";
    $msg = "deneme";
    $from_name = "myself";
    $from_address = "hello@kalfaoglu.net";
    $headers = "From: $from_name<$from_address>\n";
    $headers .= "MIME-Version: 1.0\n" .
    "Content-Type: text/html; charset=Windows-1254";
    mail($to_address, $subject, $msg, $headers);


    $ php test.php
    Mail handler 'limit-out' said: REPLY:554:5.7.0 Your message could not be sent. The user turgut is not allowed to send email.

    However root user CAN send the same email..  Regular users can't.. What could be the cause?

     

    0
    Comment actions Permalink
  • Avatar
    Anton Maslov

    @Turgut, you have a different issue. Seems like sending mail by scripts just disabled, check here how to enable:

    https://support.plesk.com/hc/en-us/articles/213907645-Mails-from-contact-form-or-after-scheduling-tasks-are-not-getting-delivered-You-are-not-allowed-to-use-sendmail-utility

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request