2.14.3.1.7. Error RCPT TO not accepted from server

Error "RCPT TO not accepted from server" in OpenCart most often occurs when site attempts to send an email with an incorrect sender address. By default, OpenCart uses store mailbox in from header, which causes this issue.

⚠️ Error "RCPT TO not accepted from server" is returned by OpenCart scripts themselves and most often is not related to recipient address, because it is returned when processing sender address.

You can solve this problem in several ways:

Attention!

Information is taken from mail configuration guide in OpenCart. For correct email operation, we recommend configuring it exactly according to this guide.

To change store mailbox, do the following:

  1. Go to "System → Settings":
  2. To the right of the store name, click "Edit":
  3. Switch to the "Store" tab (in some versions, you may need to go to "Main" section):
  4. In the "E-Mail" field, specify mailbox to receive emails and to be specified in SMTP connection settings (you can specify additional mailboxes later):

Attention!

Before performing actions create a site backup and download it to your device to be able to restore SMTP handler file at any time.

To fix email sending, edit some lines in system/library/mail/smtp.php file, namely:

  • In line 27, find this code:
    $header .= 'From: =?UTF-8?B?' . base64_encode($this->from) . '?= <' . $this->from. '>' . PHP_EOL;

    And replace it with this:

    $header .= 'From: =?UTF-8?B?' . base64_encode($this->smtp_username) . '?= <' . $this->smtp_username . '>' . PHP_EOL;
  • In line 27, find this code:
    fputs($handle, 'MAIL FROM: <' . $this->from . '>XVERP' . "\r\n");

    And replace it with this:

    fputs($handle, 'MAIL FROM: <' . $this->smtp_username . '>XVERP' . "\r\n");
  • In line 27, find this code:
    fputs($handle, 'MAIL FROM: <' . $this->from. '>' . "\r\n");

    And replace it with this:

    fputs($handle, 'MAIL FROM: <' . $this->smtp_username . '>' . "\r\n");

After making changes, check email sending. Note that as sender mailbox will be specified mailbox used for SMTP connection. You should also understand that when updating or installing some extensions, you may need to apply changes again.

Content