From: mouss on
Jordi Espasa Clofent a �crit :
> Hi all,
>
> I've a PHP script which is executed by 'www-data' (the httpd user) local
> user in Debian GNU/Linux box. I use this smtpd box as massive mailing
> remainder to all of our costumers. Because of that I need to know the
> costumers haven't could be contacted, so I want to redirect these
> bounces to dedicated mailbox.
>
> That's easy:
>
> www: failed_delivery(a)domain.com
>
> in aliases and rebuild the aliases.
>
> But the problem is local user 'www-data' executes a lof of scripts using
> smtpd and I don't want to redirecto all the bounces to mailbox
> failed_delivery(a)domain.com.
>
> �Is there any way to establish some pattern disctintion?
>
> For example, let's to suppose that my massive mails are always generated
> with FROM: warnings(a)domain.com:
>
> �Can I set up "www: failed_delivery(a)domain.com" in alias when _ONLY_ the
> FROM is warnings(a)domain.com?
>
> Thanks in advance.

set the envelope sender. if your PHP calls sendmail, then see the "-f"
flag in the sendmail doc. if it uses SMTP, then use the "MAIL FROM" command.

don't play with headers. Headers are not to be used for mail routing.

From: mouss on
Jordi Espasa Clofent a écrit :
> On 04/07/2010 10:43 AM, Levente Birta wrote:
>> I think it is easier to config the return path when you send the mails.
>>
>
> Yes, it's easy to insert a mail header as "ReturnPath" when you build
> the warning mail using PHP, but I read in RFC2821:
>
> "When the delivery SMTP server makes the "final delivery" of a
> message, it inserts a return-path line at the beginning of the mail
> data. This use of return-path is required; mail systems MUST support
> it. The return-path line preserves the information in the <reverse-
> path> from the MAIL command. Here, final delivery means the message
> has left the SMTP environment. Normally, this would mean it had been
> delivered to the destination user or an associated mail drop, but in
> some cases it may be further processed and transmitted by another
> mail system."
>
> I don't see cleary that it means the ReturnPath header is intended for
> what I'm looking for.

As the cited text says: the return-path header is added at final
delivery. don't play with that. What you need is the envelope sender.

with sendmail, it's the "-f" flag:
# sendmail -f foo(a)example.com ....

with SMTP? it's the "MAIL FROM" command.