Does Gmail not allow the sender to set the return path value to receive rejection messages?

I use Swift Mailer to check scanned messages. I created one separate account for failure messages, however, when I set the return path, it does not allow the failure message to send this account. Is this normal or is it a code error?

$verp = 'bounces-' . str_replace('@', '=', $row['ReplyTo']) . '@gmail.com'; $message = Swift_Message::newInstance() ->setSubject($row['Subject']) ->setFrom(array($row['ReplyTo'] => $row['FromName'])) ->setReturnPath($verp) ->setBody($html, 'text/html') ->addPart($txt, 'text/plain'); 

Now I'm using VERP, it seems that I need to find a delivery error? But not to send a message to your bounce account?

+4
source share
2 answers

Yes, it is normal. When sending emails through Gmail's SMTP servers, this will cause the return path to become the account that you are sending.

Your only solution is to look for a provider that allows you to set the return path.

+5
source

This is not a gmail problem, it is a requirement of the SMTP specification as defined in RFC 5321 section 4.4 :

An SMTP system sending messages MUST NOT send a message that already contains a Return-path header field.

It also states that while SMTP systems should not check message content at all (i.e. they do not look at the headers), the gateway MUST remove any return path header from any other context in SMTP. In short, if you add a return path header, you are doing it wrong.

The header of the return path that you see in the received message is created by the recipient, not the sender, and obtained from the SMTP MAIL FROM command used to deliver the message. This address should have nothing to do with the From From header in the message and indicates where the message should be sent in case of delivery failure, that is why you want to get the VERP address.

I do not know about SwiftMailer, but in PHPMailer you can set the value of the sender of the SMTP envelope by setting the Sender property, and the recipient will convert it to the message header of the return path upon receipt.

+1
source

Source: https://habr.com/ru/post/916802/


All Articles