Hello, there was a problem with the letters that are returned if they were not delivered for some reason.
They need to be redirected to another email.
But the return-path header does not work.
I set my return-path , but, after sending, a letter arrives not in the box that is specified, but on the one from which it was sent, and my assigned email is erased in the letter.
An example of my code:
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; $body .= '<html xmlns="http://www.w3.org/1999/xhtml">'; $body .= '<head>'; $body .= '<meta http-equiv="Content-Type" content="text/html; charset="' . Yii::$app->charset . '" />'; $body .= '<title></title>'; $body .= '</head>'; $body .= '<body>'; $body .= 'Test Message'; $body .= '</body>'; $body .= '</html>'; Yii::$app->mailer->useTransport('system')->compose() ->setFrom(['example@some.com' => 'example.com']) ->setReturnPath('bounced@some.com') ->addHeader('Reply-To', 'bounced@some.com') ->setTo('example2@some.com') ->setSubject('TEST MESSAGE') ->setHtmlBody($body) ->send(); To send mail using swiftmailer .
I Google already for a long time, the installation of any other headers did not lead to a positive result.
Maybe you have any options?
Headers that come back:
Return-path: <example@some.com> Envelope-to: example2@some.com Delivery-date: Thu, 13 Oct 2016 17:42:28 +0300 Received: from some.com ([159.203.33.129]) by site.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from <example@some.com>) id 1buhDH-0002DI-S0 for example2@some.com; Thu, 13 Oct 2016 17:42:27 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=site.com; s=dkim; h=Content-Transfer-Encoding:Content-Type:MIME-Version:To:From:Subject:Date:Message-ID; bh=TJEj83H/pPguf4pMS+4FcdmBzKkRiY+DeLg2oWD2/iQ=; b=kA3lrgCRo3Wqr6ky6JVhytV6m/Qx1L3NXFybgPWxyBE5bEqqFGWgOEJQd5O5sppbDnfWB780Hz0FKA8OiiT3IrbzvohHzjRf5SD/IYFz6IaGaN9jwVTojo5jFfBv8t6lv9KprH6MFQEqKJ8bqKNGp3HYIWlr6DXQAEAAl6CogqY=; Received: from [178.74.217.102] (helo=[127.0.0.1]) by site.com with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from <example@some.com>) id 1buhDG-0001i4-Su for example2@some.com; Thu, 13 Oct 2016 10:42:27 -0400 Message-ID: <34cb7242e992226ad1d1f74b821c325f@swift.generated> Date: Thu, 13 Oct 2016 10:42:25 -0400 Subject: TEST MESSAGE From: "Example.com" <example@some.com> To: example2@some.com MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable;Return-path: <example@some.com> Envelope-to: example2@some.com Delivery-date: Thu, 13 Oct 2016 17:42:28 +0300 Received: from some.com ([159.203.33.129]) by site.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from <example@some.com>) id 1buhDH-0002DI-S0 for example2@some.com; Thu, 13 Oct 2016 17:42:27 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=site.com; s=dkim; h=Content-Transfer-Encoding:Content-Type:MIME-Version:To:From:Subject:Date:Message-ID; bh=TJEj83H/pPguf4pMS+4FcdmBzKkRiY+DeLg2oWD2/iQ=; b=kA3lrgCRo3Wqr6ky6JVhytV6m/Qx1L3NXFybgPWxyBE5bEqqFGWgOEJQd5O5sppbDnfWB780Hz0FKA8OiiT3IrbzvohHzjRf5SD/IYFz6IaGaN9jwVTojo5jFfBv8t6lv9KprH6MFQEqKJ8bqKNGp3HYIWlr6DXQAEAAl6CogqY=; Received: from [178.74.217.102] (helo=[127.0.0.1]) by site.com with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from <example@some.com>) id 1buhDG-0001i4-Su for example2@some.com; Thu, 13 Oct 2016 10:42:27 -0400 Message-ID: <34cb7242e992226ad1d1f74b821c325f@swift.generated> Date: Thu, 13 Oct 2016 10:42:25 -0400 Subject: TEST MESSAGE From: "Example.com" <example@some.com> To: example2@some.com MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
UDP
To send emails use mailjet .