sendmail: fatal: /etc/mailname: cannot open file: Permission denied

Discussion in 'Installation/Configuration' started by Gouzi, Mar 20, 2021.

  1. Gouzi

    Gouzi New Member

    Hi everyone,
    I have (ISPconf3 w.3 clients 6+webpages, @server, Apache2 w. php 7.4 - when I execute "php mail.php" in cmd line, Message is sent successfully.
    ---------------------------
    $to = 'tk@....';
    $subject = 'Marriage Proposal';
    $message = 'Hi Jane, will you marry me?';
    $from = 'peterparker@...';

    // Sending email
    if(mail($to, $subject, $message, $headers)){
    echo 'Your mail has been sent successfully.';
    } else{
    echo 'Unable to send email. Please try again5 .';
    }
    ?>
    -------------------------------
    (Booth @ existing).

    if I open the same .php from the browser, I will see error message from the script "Unable to send email. Please try again5 ."

    I find in Apache2.log error: sendmail: fatal: /etc/mailname: cannot open file: Permission denied
    I tried to change owner of mailname to sendmail:sendmail / sendmail:root w/o any change.

    - I believe that from same problem does not work Autoresponder in ISPconfig.

    Any suggestions how to resolve it ?
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Set the user to root:root and permission to mode 644.
     
    Gouzi likes this.
  3. Gouzi

    Gouzi New Member

    I feel so lame :) It was 640 and +4 fixed phpmail & also autoresponder issue. Thank you Jesse.
     

Share This Page