Unable to send email using php scripts via Browser

Follow

Comments

8 comments

  • Avatar
    Bhartendu Vimal

    Thanks for this information.Sending Mail in PHP Using PHP Scripts is one of the very good ways where you can send multiple emails through PHP scripts. Thanks for this information.

  • Avatar
    William Dugger (Edited )

    Followed article but still no email can be sent using php.  Doesn't even show in the mail queue.

  • Avatar
    Michael S.

    >Plesk > Tools & Settings > Mail Server Settings 

    >Plesk > Subscriptions > example.com > Change Outgoing Mail Limits

     

    Please show on screenshots how it must be there enabled?

    I have nothning about sendmail there.

  • Avatar
    Nikita Nikushkin

    Hi @William Dugger,

    Maybe the issue is related to the PHP script itself?

    In order to check it, perform the next actions:

    1. Create a file under the domain home directory with the following content:

    <?php
    mail('johndoe@example.com','hello','test mail function');
    ?>

    2. Make sure that PHP support is enabled for the domain at the "Plesk > Domains > example.com > PHP Settings" page

    3. Try to open the PHP script via a browser:

    https://example.com/testfile.php

    If the issue still occurs without any info in logs, it is better to create a request to Plesk Support for further issue investigation

  • Avatar
    Alisa Kasyanova

    @Michael M.
    I have added te screenshots to the article, hope it may the article more informative.
    As for the GastCGI issue, if you are using SELinux, check the following article: https://support.plesk.com/hc/en-us/articles/213361389-Cannot-send-email-using-PHP-mail-function-Unable-to-rename-usr-local-psa-handlers-spool-messageXXX-file-Permission-denied

  • Avatar
    Nikita Nikushkin

    Hi @Pepe Castillo,

    Maybe your mailbox-recipient is identified as a local instead of the external one

    Take a look at this article:

    Mail to external mail service is delivered locally

  • Avatar
    Pepe Castillo

    I follow this and other steps for enable php mail() function with out smtp I have my messages in the queue but with proposed state, when I try to send them my maillog return this errors:

    Jul 8 09:31:39 www5 journal: plesk sendmail[60120]: handlers_stderr: PASS
    Jul 8 09:31:39 www5 journal: plesk sendmail[60120]: PASS during call 'limit-out' handler
    Jul 8 09:31:39 www5 check-quota[60122]: Starting the check-quota filter...
    Jul 8 09:31:39 www5 journal: plesk sendmail[60120]: handlers_stderr: SKIP
    Jul 8 09:31:39 www5 journal: plesk sendmail[60120]: SKIP during call 'check-quota' handler
    Jul 8 09:31:39 www5 postfix/pickup[55370]: C93C9181F8: uid=10000 from=<logicapp@logicapp.es>
    Jul 8 09:31:39 www5 postfix/cleanup[60127]: C93C9181F8: message-id=<20190708093139.C93C9181F8@www5.medicon-apotheke.de>
    Jul 8 09:31:39 www5 postfix/qmgr[25687]: C93C9181F8: from=<logicapp@logicapp.es>, size=451, nrcpt=1 (queue active)
    Jul 8 09:31:39 www5 postfix-local[60132]: postfix-local: from=logicapp@logicapp.es, to=info@logicapp.es, dirname=/var/qmail/mailnames
    Jul 8 09:31:39 www5 postfix-local[60132]: cannot chdir to mailname dir info: No such file or directory
    Jul 8 09:31:39 www5 postfix-local[60132]: Unknown user: info@logicapp.es
    Jul 8 09:31:39 www5 postfix/pipe[60131]: C93C9181F8: to=<info@logicapp.es>, relay=plesk_virtual, delay=0.06, delays=0.04/0.01/0/0.01, dsn=2.0.0, status=sent (delivered via plesk_virtual service)
    Jul 8 09:31:39 www5 postfix/qmgr[25687]: C93C9181F8: removed

    Any clue?

  • Avatar
    Michael S.

    Hello,

    if i set PHP Handler to FAST CGI http://prntscr.com/myb2a9

    i can not send any email vie mail() function. It returns always error.

    /var/log/mail.err

    Mar 15 14:54:10 h2825876 plesk sendmail[6934]: _mh_fork(): Error occured during fork(): Resource temporarily unavailable
    Mar 15 14:54:10 h2825876 plesk sendmail[6934]: Error during 'check-quota' handler
    Mar 15 14:54:10 h2825876 plesk sendmail[6936]: my_popen(): fork() failed: Resource temporarily unavailable [11]
    Mar 15 14:54:10 h2825876 plesk sendmail[6936]: Unable to execute MTA

    How to fix this bug?

    With PHP-FPM it works!

    Thanks!

     

     

Please sign in to leave a comment.

Have more questions? Submit a request