Articles in this section

Emails sent from Plesk server using PHP mail() function are rejected on some recipient mail servers

Plesk for Linux kb: technical ABT: Group A

Applicable to:

  • Plesk for Linux

Symptoms

  • Emails are sent from the subscription's additional domain using the PHP script with the mail() function:

    CONFIG_TEXT: <?php
    $email="receiver@example.net";
    mail($email, "test from example.com", "This body ", "From: sender@example.com\r\nContent-Type:text/plain; charset="utf-8"");
    echo 'mail send to '.$email;
    ?>

  • According to the records from the file /var/log/maillog, such messages are rejected on some recipient servers:

    CONFIG_TEXT: plesk.example.com postfix/pickup[658]: 89263102015: uid=10520 from=<sysuser@main-subscription-domain.com>
    plesk.example.com postfix/cleanup[801]: 89263102015: message-id=<20190123131952.89263102015@plesk.example.com>
    plesk.example.com postfix/qmgr[659]: 89263102015: from=<sysuser@main-subscription-domain.com>, size=537, nrcpt=1 (queue active)
    plesk.example.com postfix/smtp[1049]: 89263102015: to=<receiver@example.net>, relay=mail.example.net[203.0.113.2]:25, delay=18, delays=0/0.02/18/0.17, dsn=5.0.0, status=bounced (host mail.example.net[203.0.113.2] said: 550 Can't verify main-subscription-domain.com sender. Check your DNS configuration. (in reply to RCPT TO command))
    plesk.example.com postfix/bounce[1170]: 89263102015: sender non-delivery notification: 90B7E10204A
    plesk.example.com postfix/qmgr[659]: 89263102015: removed

  • The domain main-subscription-domain.com is not resolved over DNS.

Cause

When sending emails from the Plesk server using PHP mail() function, the address like sysuser@main-subscription_domain.com is by default used as the From: address.

On some recipient SMTP servers, the verification of the sender domain is enabled, and, as the domain main-subscription-domain.com is not resolved over DNS, the verification fails and the messages are rejected.

Resolution

For one domain
  1. Log into Plesk.

  2. Go to Domains > example.com > PHP Settings.

  3. Add the following line to the field Additional configuration directives:

    CONFIG_TEXT: sendmail_path="/usr/sbin/sendmail -t -i -f sender@example.com"

    Replace sender@example.com with the address which should be used as a sender.

  4. Click OK or Apply to save the changes.

For all domains under specific PHP version
  1. Log into Plesk.

  2. Go to Tools & Settings > PHP Settings > PHP_version > php.ini.

  3. Modify the parameter sendmail_path:

    CONFIG_TEXT: sendmail_path="/usr/sbin/sendmail -t -i -f sender@example.com"

    Replace sender@example.com with the address which should be used as a sender.

  4. Click OK to save the changes.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.