On 2018-01-20, Grant Taylor <gtay...@tnetconsulting.net> wrote: > On 01/19/2018 04:58 PM, Grant Edwards wrote: > >> That would require seperate outbound transports that are selected based >> on how the mail was read: smtp vs. /usr/bin/sendmail (the real one). > > Okay.... > >> I get the impression from exim and postfix docs that outbound routing >> based on input method aren't possible (I may be wrong about that). > > Depending on what exactly you're needing, I might be able to think of a > way to do this with Sendmail. - This may be one of the exceedingly > rare times that Sendmail's splitting MTA and MSA roles may actually be > beneficial (other than for the security reasons).
[...] > Am I regurgitating this properly? > > 1) You want incoming SMTP connections to go out via your custom mailer > script. > > 2) You want messages originated locally and piped into $commandTBD to > go out via SMTP. Yes -- the two are completely unrelated and unconnected. > Would I be correct in assuming that the path and / or name of the > sendmail like script that interfaces with the Exchange server could > change if necessary? I.e. you could name it > /usr/local/bin/sendmail_to_exchange_gateway if you needed to. Yes. It's not actually located at /usr/bin/sendmail, and doesn't need to be. > Question: What name are your scripts currently calling to interface > with msmtp? - Can that name change if necessary? Yes they can be changed. Most of the things that invoke msmtp invoke it as /usr/bin/msmtp. A few invoke it as /usr/bin/sendmail. > I'm trying to juggle the various pieces as I understand them to see if > everything can work together. Don't waste any time on it -- I think the current SMTP server combined with stunnel is going to work. > Note: I'm not trying to push Sendmail. - I know I'm strange in my > predilection for it. - I'm simply trying to solve the problem (as I > understand it) with the tools that I know. > >> Well I have several msmtp "accounts" set up and run multiple mutt >> configurations that use those different accounts for outbound mail. > > The different accounts outbound may complicate things. Are those > accounts configured as part of msmtp? Or are they configured in the > things using msmtp? Both. msmtp has a config file that defines the accounts, and things that invoke msmtp directly (e.g. mutt) use a command-line option to specify an account. There is a default account that's used if the command line option isn't present (which would be the case for apps that invoke msmtp as '/usr/bin/sendmail'). Now that I think about it, I think a configuration that chooses outbound routes for locally generated email based on from address could work. Several of those accounts/routes actually go to the same SMTP server but authenticate with different username/password combinations. In mutt's case, I also believe I could switch from msmtp to mutt's "new" built-in SMTP client code. Another option would be to set up a container in which to run the "relay" MTA (sendmail/exim/postfix) that's doing SMTP --> sendmail-like-script. This is probably the cleanest way to do it. But, that's all moot if the stunnel solution works. -- Grant