Gentoo Archives: gentoo-user

From: Grant Edwards <grant.b.edwards@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?
Date: Sat, 20 Jan 2018 00:56:10
Message-Id: p3u3tu$dcg$1@blaine.gmane.org
In Reply to: Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay? by Grant Taylor
1 On 2018-01-20, Grant Taylor <gtaylor@××××××××××××××.net> wrote:
2 > On 01/19/2018 04:58 PM, Grant Edwards wrote:
3 >
4 >> That would require seperate outbound transports that are selected based
5 >> on how the mail was read: smtp vs. /usr/bin/sendmail (the real one).
6 >
7 > Okay....
8 >
9 >> I get the impression from exim and postfix docs that outbound routing
10 >> based on input method aren't possible (I may be wrong about that).
11 >
12 > Depending on what exactly you're needing, I might be able to think of a
13 > way to do this with Sendmail. - This may be one of the exceedingly
14 > rare times that Sendmail's splitting MTA and MSA roles may actually be
15 > beneficial (other than for the security reasons).
16
17 [...]
18
19 > Am I regurgitating this properly?
20 >
21 > 1) You want incoming SMTP connections to go out via your custom mailer
22 > script.
23 >
24 > 2) You want messages originated locally and piped into $commandTBD to
25 > go out via SMTP.
26
27 Yes -- the two are completely unrelated and unconnected.
28
29 > Would I be correct in assuming that the path and / or name of the
30 > sendmail like script that interfaces with the Exchange server could
31 > change if necessary? I.e. you could name it
32 > /usr/local/bin/sendmail_to_exchange_gateway if you needed to.
33
34 Yes. It's not actually located at /usr/bin/sendmail, and doesn't need
35 to be.
36
37 > Question: What name are your scripts currently calling to interface
38 > with msmtp? - Can that name change if necessary?
39
40 Yes they can be changed. Most of the things that invoke msmtp invoke
41 it as /usr/bin/msmtp. A few invoke it as /usr/bin/sendmail.
42
43 > I'm trying to juggle the various pieces as I understand them to see if
44 > everything can work together.
45
46 Don't waste any time on it -- I think the current SMTP server combined
47 with stunnel is going to work.
48
49 > Note: I'm not trying to push Sendmail. - I know I'm strange in my
50 > predilection for it. - I'm simply trying to solve the problem (as I
51 > understand it) with the tools that I know.
52 >
53 >> Well I have several msmtp "accounts" set up and run multiple mutt
54 >> configurations that use those different accounts for outbound mail.
55 >
56 > The different accounts outbound may complicate things. Are those
57 > accounts configured as part of msmtp? Or are they configured in the
58 > things using msmtp?
59
60 Both. msmtp has a config file that defines the accounts, and things
61 that invoke msmtp directly (e.g. mutt) use a command-line option to
62 specify an account. There is a default account that's used if the
63 command line option isn't present (which would be the case for apps
64 that invoke msmtp as '/usr/bin/sendmail'). Now that I think about it,
65 I think a configuration that chooses outbound routes for locally
66 generated email based on from address could work. Several of those
67 accounts/routes actually go to the same SMTP server but authenticate
68 with different username/password combinations.
69
70 In mutt's case, I also believe I could switch from msmtp to mutt's
71 "new" built-in SMTP client code.
72
73 Another option would be to set up a container in which to run the
74 "relay" MTA (sendmail/exim/postfix) that's doing SMTP -->
75 sendmail-like-script. This is probably the cleanest way to do it.
76
77 But, that's all moot if the stunnel solution works.
78
79 --
80 Grant