Set Mautic to set a simple bounce adress

Views: 1424

F you do not have the means to setup a catchall:
In app/bundles/EmailBundle/Helper/MailHelper.php:

Change:

public function generateBounceEmail($idHash = null)
    {
        $monitoredEmail = false;

        if ($settings = $this->isMontoringEnabled('EmailBundle', 'bounces')) {
            // Append the bounce notation
            list($email, $domain) = explode('@', $settings['address']);
            $email .= '+bounce';
            if ($idHash) {
                $email .= '_'.$this->idHash;
            }
            $monitoredEmail = $email.'@'.$domain;
        }

        return $monitoredEmail;
    }

to:

    public function generateBounceEmail($idHash = null)
    {
        $monitoredEmail = false;

        if ($settings = $this->isMontoringEnabled('EmailBundle', 'bounces')) {
            // Append the bounce notation
          /*  list($email, $domain) = explode('@', $settings['address']);
            $email .= '+bounce';
            if ($idHash) {
                $email .= '_'.$this->idHash;
            }
		  */
            $monitoredEmail = $settings['address'];
        }

        return $monitoredEmail;
    }

This behavior also occurs with unsubscribe headers, so change:

public function generateUnsubscribeEmail($idHash = null)
    {
        $monitoredEmail = false;

        if ($settings = $this->isMontoringEnabled('EmailBundle', 'unsubscribes')) {
            // Append the bounce notation
            list($email, $domain) = explode('@', $settings['address']);
            $email .= '+unsubscribe';
            if ($idHash) {
                $email .= '_'.$this->idHash;
            }
            $monitoredEmail = $email.'@'.$domain;
        }

        return $monitoredEmail;
    }

to:

    public function generateUnsubscribeEmail($idHash = null)
    {
        $monitoredEmail = false;

        if ($settings = $this->isMontoringEnabled('EmailBundle', 'unsubscribes')) {
            // Append the bounce notation
         /*   list($email, $domain) = explode('@', $settings['address']);
            $email .= '+unsubscribe';
            if ($idHash) {
                $email .= '_'.$this->idHash;
            }*/
            $monitoredEmail = $settings['address'];
        }

        return $monitoredEmail;


Source: https://www.mautic.org/community/index.php/2613-bounce-management/0

Leave a Reply