Re: How getmail deals with delivery errors and with bounce e-mails

Charles Cazabon <[email protected]>
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Martin Gregorie <[email protected]> wrote:
> On Tue, 2020-11-03 at 16:09 +0100, R. Diez wrote:
>    
> > Do you mean that getmail runs the version of sendmail that Postfix
> > provides?
> > 
> Yes.
> 
> > If so, could you give me an example configuration? That would save me
> > some research time.
> > 
> Dead simple. From my getmail script:
> 
> /usr/sbin/sendmail -i -f "$sender" -- MYUSER

Egads, no, don't do this!  You're injecting a message into the local MDA,
using the apparent envelope sender address of the source message as the new
envelope sender.  

This is the one thing you absolutely DO NOT want to do.  If you have to
reinject, set the envelope sender address to the null sender (empty string) or
to a static email address that lives on the local machine.  i.e., you should
immediately replace the above with:

  /usr/sbin/sendmail -i -f "" -- MYUSER

or:

  /usr/sbin/sendmail -i -f bounces@localdomain -- MYUSER

... otherwise, your MTA can end up bouncing messages out of the machine again,
which is what I desperately am trying to convince the OP not to do.

> Its not in the manpage, but IIRC the final ' -- MYUSER ' is a default
> destination if for some reason the message lacks a To: header or doesn't
> match any login name.

Not quite.  In this case, you're (accidentally) doing the right thing, telling
sendmail "send this message to MYUSER, ignore all that crap in the To:, cc:,
etc headers).

"--" means "everything after this is an argument, not an option, even if it
starts with a dash", so it forces the MYUSER to be interpreted as a
non-option argument - which to the sendmail command interface means "to this
address".

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.