Does Gmail not allow sender to set a return path value to receive bounce messages?
Asked Answered
J

2

4

I am using Swift Mailer to check for bounced messages. I have created one separate account for bounce messages, however when I set the return path, it does not allow the bounce message send to that account. Is it 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');

I am now using VERP, it seems that it is to locate a delivery error? But not for sending the message to a bounce mail account?

Jocular answered 29/3, 2012 at 12:32 Comment(0)
L
8

Yes, that is normal. When sending email through Gmail's SMTP servers, it will force the return-path to be the account you are sending from.

Your only solution is to search for a provider which allows you to set the return-path.

Longsome answered 29/3, 2012 at 12:39 Comment(4)
Thank you, although it does not allow that ,but there are two return path in the header. Is that the same for other providers, if not, how can i use verp? ( Verp is to check the fail receipent mail , it use return path, but return path is the address to send the bounce back, how can they co-exist? Thank you)Jocular
Other providers (especially bulk mail providers such as mail chimp, etc) should be able to allow you to set the return-path. However, its best to test them out before commiting. For VERP to work, can you just set it to use the account sending the email to receive the bounces?Longsome
just set it to use the account sending the email to receive the bounces. <==This has a problem becasue the receipent may reply to me, and they will send mail to this account.Jocular
One possible solution could be to set the reply-to header for the receipients to reply to. But obviously, the return-path is built for bounces. In such a case, I recommend investigating an alternative email provider.Longsome
B
4

It's not a gmail issue, it's a requirement of the SMTP specification, as defined in RFC 5321 section 4.4:

A message-originating SMTP system SHOULD NOT send a message that already contains a Return-path header field.

It also says that while SMTP systems should not inspect message content at all (i.e. they don't look at headers), a gateway from some other context to SMTP SHOULD remove any return-path header. In short, if you're adding a return-path header yourself, you're doing it wrong.

The return-path header you see in a received message is created by the receiver, not the sender, and is derived from the SMTP MAIL FROM command used to deliver the message. This address need not to have anything in common with the From address header within the message, and designates where the message should be sent to in the event of a delivery failure, i.e. exactly what you want the VERP address for.

I don't know about SwiftMailer, but in PHPMailer you can set the SMTP envelope sender value by setting the Sender property, and a receiver will convert that into a return-path message header on reception.

Barcelona answered 7/9, 2016 at 6:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.