On 25 April 2018 at 19:25, Gary Smith <gary.sm...@holdstead.com> wrote:
> Hi Everyone,
>
> It's been a long time since something in postfix has stumped me.  I am using 
> virtual alias rewrites to handle 50k incoming email addresses that expand to 
> 1+n recipients.  The recipients are the line managers and lower level people 
> that handle those accounts.  The virtual alias has been working in a general 
> sense, lately I have been receiving bounces from Comcast and google with 
> invalid recipients.  Normally this would be expected if a manager entered the 
> wrong email for a line member (these are outside consultants using gmail, 
> Comcast, etc).  The bounce however shows the original email address and not 
> the alias email address, so it's really hard to track down the email issue 
> this way.
>
> So I would like to either rewrite the "to" field or add a header with the 
> exploded virtual alias mapping.  From reading a few external articles the 
> email should already have the to field set in the header, but that 
> contradicts what I have read in the postfix virtual readme.  I have also 
> tried using a header_check to and a new header (which I can do for the 
> original address, but not the virtual alias mapped address).
>
> When it's bounces via gmail I get the bounce below, which shows the original 
> TO and not the expected virtual alias mapped.  I have several gmail accounts 
> that are successful however.
>
> What I would really like to do is add the envelope TO field to the TO header 
> of the outgoing emails.  Is this possible?  This would let us at least track 
> the bounces.  Is there a better approach?
>
> Bounce message:
>
> mx.google.com rejected your message to the following email addresses:
> original_email_address (original_email_addr...@accounts.jellybelly.com)
> The email address you entered couldn't be found. Please check the recipient's 
> email address and try to resend the message. If the problem continues, please 
> contact your email admin.
> mx.google.com gave this error:
> The email account that you tried to reach does not exist. Please try 
> double-checking the recipient's email address for typos or unnecessary 
> spaces. Learn more at https://support.google.com/mail/?p=NoSuchUser 
> p25si12399124pgd.395 - gsmtp
>
>
> Diagnostic information for administrators:
> Generating server: FFExchange3.jellybelly.net
> original_email_addr...@accounts.jellybelly.com...

The log entry placed by postfix/smtp (in e.g. /var/log/mail.log), and
which contains the rejection response from the remote server, should
contain both the original and remapped mail addresses. Something like:

2018-03-29 16:21:07 yourserver postfix/smtp[2041]: 3127960764:
to=<janedoe998...@gmail.com>, orig_to=<j...@yourdomain.tld>,
relay=gmail-smtp-in.l.google.com[66.102.1.27]:25, delay=0.73,
delays=0.02/0.02/0.47/0.21, dsn=5.7.0, status=bounced (host
gmail-smtp-in.l.google.com[66.102.1.27] said: 552-5.7.0 This
message...  - gsmtp (in reply to end of DATA command))

Reply via email to