bruceg / nullmailer

Relay-only sendmail/qmail/etc replacement MTA
http://untroubled.org/nullmailer/
GNU General Public License v2.0
184 stars 43 forks source link

How to pass arguments to nullmailer-inject #59

Open JsBergbau opened 5 years ago

JsBergbau commented 5 years ago

The file adminaddr is used when address ends for example with "@localhost" However if only user specified like cron does like -i -FCronDaemon -B8BITMIME -oem pi nothing is replaced and mail is sent to e.g. pi@gmail.com Luckily google usernames must be at least 6 characters otherwise someone registering pi@gmail.com would get a lot of mails from raspberrypi

I've created a wraper script, because allmailfrom just changed the returnpath header to allmailfrom content, but "From: " header still remained the original From: header. It uses NULLMAILER_USER and NULLMAILER_HOST to replace the from address and replaces any "To: " line without a "@" sign to user given admin, if you're interested see https://github.com/JsBergbau/nullmailer-Rewrite-Wrapper

Problem: To header is rewritten in the mail header is now

Received: from gmail.com (XXXX.dip0.t-ipconnect.de. [X.Y.Z.A])
        by smtp.gmail.com with ESMTPSA id XXXXXX
        for <pi@gmail.com>
(...)
To: [CORRECT To E-Mail Adress]

Nullmailer still seems to use the to address from commandline. In man nullmailer-inject is written -h Use only data from the message header as the recipient addresses. That is exactly what we need here.

So how to pass the -h argument to nullmailer-inject? (without writing another wrapper :-) )

JsBergbau commented 5 years ago

Obviously there is no way to pass the -h argument from sendmail. With nullmailer sendmail is just there for programs that expect a sendmail binary, see https://manpages.debian.org/jessie/nullmailer/sendmail.1.en.html So I've updated the Rewrite Wrapper Script to change local user destinations to Admin_Adress https://github.com/JsBergbau/nullmailer-Rewrite-Wrapper