Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-10 Thread Sébastien Hinderer
Hello Michael,

Michael Stone (2022/09/09 11:01 -0400):
> I would not recommend msmtp if you have a local mail service configured on
> the system because you then have two places to debug mail problems.

I agree it's suboptimal somehow, but as you could see others do that...

> Another possibility if you're only going to send the work emails via mutt is
> to use mutt's internal smtp, something likeset
> smtp_url="smtp://u...@example.com@smtp.example.com:587/"
> You can then use mutt's folder & account hook facilities to switch between
> local and external smtp depending on which account is open. I tend to think
> this is cleaner than hard-coding a per-user credential into a global
> configuration, and is much more practical than implementing xoauth2 (if
> needed) in the system mta.

Sure but (correct me if I am wrong), this would only work on a system
that has constant access to the network, right? I am guessing that mutt
does not know, internally, how to queue messages so if you write an
e-mail while you are offline it's not going to work. Or am I wrong?

> On Thu, Sep 08, 2022 at 01:06:07PM +0800, Jeremy Ardley wrote:
> > It's incredibly easy using postfix sender_dependent_relayhost_maps
> 
> Specifically, for example:
> 
> /etc/postfix/main.cf: sender_dependent_relayhost_maps = 
> hash:/etc/postfix/sender_relay
> 
> /etc/postfix/sender_relay: @example.com [smtp.example.com]:587
> 
> This sort of configuration typically requires a password, which is another
> couple of entries in main.cf (smtp_sasl_password_maps, etc) and another file
> containing the username/password. Though, see above for thoughts about doing
> per-user auth at the MUA rather than the MTA.

I had missed Jeremy's response because I was not Cc-ed, so I am greatly
thankful for having quoted it, thanks!

Well, one more solution to consider, but certainly too many solutions is
better than too few.


> 
> > One option retaining exim4 is to use postfix as an outgoing mail gateway
> > and forward to it from the exim4 instance.
> 
> That also sounds like a debugging nightmare. I'd just pick one.

Well, I can imagine myself combining exim4 and msmtp, but frankly,
combining exim4 and postfix really feels overkill to me (responding to
JEremy, here).

Sébastien.




Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-10 Thread Sébastien Hinderer
Julio Herrero (2022/09/09 15:07 +0200):
> El mié, 07-09-2022 a las 22:31 +0200, Sébastien Hinderer escribió:
> > I would like to be able to
> > configure the SMTP server to use based on the address I am using in
> > the
> > > From header. For instance, if I am sending from my personal account
> > > then
> > I'd like to use one smarthost and SMTP configuration, but if I am
> > sending from my work address, I would like the MTA to choose my
> > work's
> > SMTP server as its smarthost. Am I correct that exim4 does not allow
> > for
> > such a configuration? 
> 
> I do that using an exim specific router.
> 
> $ cat /etc/exim4/conf.d/router/160_exim4-config_myfrom_1
> 
>  from_router_1:
>   debug_print = "R: from_router_1 for $domain"
>   driver = manualroute
>   domains = ! +local_domains
>   condition = ${if eq{$sender_address}{yourfromaddr...@example.com}}
>   same_domain_copy_routing = yes
>   route_data = smtp.yoursmarthost.com
>   transport = remote_smtp_smarthost

Thanks! It's good to know exim actually can do it! I'm scared to touch
its configuration because, at the moment, I am in single-file
configuration mode but I will consider this possibility!

I eveninstalled the info documentaiton and it's already strange that to
read the doc one needs to type `info spec`...

Thanks again, all the answers I recevied are great and precious!

Sébastien.



Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-10 Thread Sébastien Hinderer
Dear Gregor,

Many thanks for your messages!

Gregor Zattler (2022/09/08 10:24 +0200):
> there is https://github.com/xundeenergie/exim4-multiaccount,
> which worked for me, but I always felt uneasy because I did
> not grok the configuration.

I can understand the feeling, yes. Also, I had a look and it's all in
german! Not that I don't understand german at all, but still, it's not
as easy as english and makes it feel it's a niche thingthat never really
took over...

> > I was advised to use msmtp but, although it has the feature I am looking
> > for, it misses two features of exim4 that I find useful: local e-mail
> > delivery to users' maildirs and the ability to queue emails composed while
> > the computer is off-line so that they get sent the next time the network
> > becomes available.
> 
> I use exim4 now for local delivery only (think cron job
> mails)

Yes, that's also what I had in mind, cron. Plus the e-mails that are
sent by the Debian installer and some other services andwhich, thanks to
Exim, end up in the spool mailbox of my main user, which I find
something valuable and would prefer not to lose.

> and msmtp for delivery from my local account to
> smarthosts.  There are no other users on my system=laptop.

I have the same configuration here.

> Package msmtp features a queueing mechanism implemented via
> shell scripts.  Its buried in the example directory of it's
> documentation.  I set links from /usr/local/bin/msm... to
> /usr/share/doc/msmtp/examples/msmtpq/msm... and use msmtpq
> as sendmail:
> 
> $ lt /usr/local/bin/ | grep msm
> lrwxrwxrwx 1 root root   43 Aug  8  2021 msmtpq -> 
> /usr/share/doc/msmtp/examples/msmtpq/msmtpq
> lrwxrwxrwx 1 root root   48 Aug  8  2021 msmtp-queue -> 
> /usr/share/doc/msmtp/examples/msmtpq/msmtp-queue
> lrwxrwxrwx 1 root root6 Aug  8  2021 msmtpQ -> msmtpq
> 
> 
> It either sends email straight to the smarthost or queues
> it.  There is not *automatic* queue maintenance nor
> notification if mails were queued instead of sent.  There is
> a log file though.  Next time you send another email the
> queue will be emptied (if possible).

It would be nice to also have a cron job that regularly tries to send
queued e-mails, in case the network appears. Or someting bound to the
event of the network becoming available. I don't know which of these
ways exim4 uses to achieve sending queued e-mails but I imagine it must
be one of these two.

> There also is a package "msmtp-mta" which I did *not*
> install since it conflicts with exim4.

Yes, I noticed that to and I think if I finally follow the msmtp route
I'll do exactly like you suggest.

> But I need exim4 for local delivery.

Same here.

> In sum msmtp is configured for my single user and exim4 as a
> system wide local delivery MTA.

That approach seems reasonable to me. The only thinkg I'd maybe regret
is that, as I understandit, there is a way to achieve the same with just
exim but fully understanding it seems difficult, if one wants to do more
than just copy/pasting code blindly, which often does notwork anyway.

> For local delivery into maildirs I still use fetchmail.

Ah well on my system exim recognizes that a spoofile is a directory
and then treats it as a maildir, I think.

For the rest I connect directly to imap servers with mutt nowadays,
although I have been a fetchmail user for years and still don't leave
mails on servers.

> 
> Ciao; Gregor

Gregor Zattler (2022/09/08 17:49 +0200):
> Hi Sébastien, debian users,
> * Gregor Zattler  [2022-09-08; 10:24 +02]:
> > In sum msmtp is configured for my single user and exim4 as a
> > system wide local delivery MTA.
> 
> I forgot, this is the last part of my .msmtprc:
> 
> # use exim4 for local addresses
> account exim4
> host localhost
> tls off
> 
> ### Set a default account
> account default : exim4
> 
> 
> 
> Ciao; Gregor

Many thanks for your two answers! I don't know yet which of the proposed
solution I will end-up using, it feels like it will require some more
pondering, but in any case I find your response really valuable and
addressing the quesiton in a precise and complete manner!

Best wishes,

Sébastien.



Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-09 Thread Michael Stone

On Wed, Sep 07, 2022 at 10:31:37PM +0200, Sébastien Hinderer wrote:

I was advised to use msmtp but, although it has the feature I am looking
for, it misses two features of exim4 that I find useful: local e-mail
delivery to users' maildirs and the ability to queue emails composed while
the computer is off-line so that they get sent the next time the network
becomes available.


I would not recommend msmtp if you have a local mail service configured 
on the system because you then have two places to debug mail problems. 
(For systems with no mail service configured, it's a great solution.)


Another possibility if you're only going to send the work emails via 
mutt is to use mutt's internal smtp, something like 
   set smtp_url="smtp://u...@example.com@smtp.example.com:587/" 

You can then use mutt's folder & account hook facilities to switch 
between local and external smtp depending on which account is open. I 
tend to think this is cleaner than hard-coding a per-user credential 
into a global configuration, and is much more practical than 
implementing xoauth2 (if needed) in the system mta. 


On Thu, Sep 08, 2022 at 01:06:07PM +0800, Jeremy Ardley wrote:

It's incredibly easy using postfix sender_dependent_relayhost_maps


Specifically, for example:

/etc/postfix/main.cf: sender_dependent_relayhost_maps = 
hash:/etc/postfix/sender_relay

/etc/postfix/sender_relay: @example.com [smtp.example.com]:587

This sort of configuration typically requires a password, which is 
another couple of entries in main.cf (smtp_sasl_password_maps, etc) and 
another file containing the username/password. Though, see above for 
thoughts about doing per-user auth at the MUA rather than the MTA.


One option retaining exim4 is to use postfix as an outgoing mail 
gateway and forward to it from the exim4 instance.


That also sounds like a debugging nightmare. I'd just pick one.



Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-09 Thread Julio Herrero
El mié, 07-09-2022 a las 22:31 +0200, Sébastien Hinderer escribió:
> I would like to be able to
> configure the SMTP server to use based on the address I am using in
> the
> > From header. For instance, if I am sending from my personal account
> > then
> I'd like to use one smarthost and SMTP configuration, but if I am
> sending from my work address, I would like the MTA to choose my
> work's
> SMTP server as its smarthost. Am I correct that exim4 does not allow
> for
> such a configuration? 

I do that using an exim specific router.

$ cat /etc/exim4/conf.d/router/160_exim4-config_myfrom_1

 from_router_1:
  debug_print = "R: from_router_1 for $domain"
  driver = manualroute
  domains = ! +local_domains
  condition = ${if eq{$sender_address}{yourfromaddr...@example.com}}
  same_domain_copy_routing = yes
  route_data = smtp.yoursmarthost.com
  transport = remote_smtp_smarthost

Greetings



Re: OT: Is postfix "easier" than exim4? (was: Re: Which MTA for from-based smarthost selection, local delivery and queuing?)

2022-09-08 Thread Michael Stone

On Thu, Sep 08, 2022 at 07:10:17AM -0400, rhkra...@gmail.com wrote:

To people who have familiarity with both postfix and exim4, is postfix really
easier (in a variety of senses) than exim4?  LIke to install, setup, and use?


IMO, yes. It's also easier to find solutions to problems online, 
especially as compared with the debian-specific exim config syntax.


For a simple configuration of a satellite system they're basically the 
same and will work out of the box. And in the end they can both do the 
same things, perhaps in different ways.


My gut feeling/experience is that more sites choose postfix as an edge 
MTA than choose exim4, with the exim4 counts being skewed by some large 
hosting providers and the fact that they're the debian/ubuntu default. A 
lot of places that actually pay attention to their MTA configuration 
turn off identifying banners so it's hard to say with any real 
confidence. For most users this is all irrelevant anyway.




Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-08 Thread Gregor Zattler
Hi Sébastien, debian users,
* Gregor Zattler  [2022-09-08; 10:24 +02]:
> In sum msmtp is configured for my single user and exim4 as a
> system wide local delivery MTA.

I forgot, this is the last part of my .msmtprc:

# use exim4 for local addresses
account exim4
host localhost
tls off

### Set a default account
account default : exim4



Ciao; Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-



debian-lists-test for your test posts, was Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-08 Thread David Wright
On Thu 08 Sep 2022 at 10:54:20 (-0400), rhkra...@gmail.com wrote:
> Sorry, this is a test email.  Not sure how to do it "off list" (more 
> explanation later, maybe)

There's a very underpublicised list called

  debian-lists-test

specially designed for such tests.

Cheers,
David.



OT: Bug (or feature?) in (old) kmail: "Undisclosed Recipients" (was: Re: Which MTA for from-based smarthost selection, local delivery and queuing?)

2022-09-08 Thread rhkramer
On Thursday, September 08, 2022 10:54:20 AM rhkra...@gmail.com wrote:
> Sorry, this is a test email.  Not sure how to do it "off list" (more
> explanation later, maybe)

Interesting.

Sometimes when I'm working on a reply to an email, I try to "disable" the 
address so that I won't accidentally send it before I intend to (either fat 
fingering something or forgetting that I meant to cover something else).

I do it in various ways.  In a recent post that started in this thread (unless 
the thread got "unthreaded"), I attempted to disable the address by inserting 
a space after the @ in the debian-user address.

I forgot about that, clicked send, and the email actually got sent, but the 
From: was shown as "Undisclosed recipients".

I don't know whether I should consider that a bug or a feature ;-) But I'll 
disable email addresses some other way in the future.

Because it is an old version of kmail, the same behavior might not occur in 
newer versions.

-- 
rhk

If you reply: snip, snip, and snip again; leave attributions; avoid HTML; 
avoid top posting; and keep it "on list".  (Oxford comma included at no 
charge.)  If you change topics, change the Subject: line. 

Writing is often meant for others to read and understand (legal agreements 
excepted?) -- make it easier for your reader by various means, including 
liberal use of whitespace and minimal use of (obscure?) jargon, abbreviations, 
acronyms, and references.

If someone else has already responded to a question, decide whether any 
response you add will be helpful or not ...

A picture is worth a thousand words -- divide by 10 for each minute of video 
(or audio) or create a transcript and edit it to 10% of the original.



Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-08 Thread rhkramer
Sorry, this is a test email.  Not sure how to do it "off list" (more 
explanation later, maybe)

On Thursday, September 08, 2022 01:06:07 AM Jeremy Ardley wrote:



Re: OT: Is postfix "easier" than exim4? (was: Re: Which MTA for from-based smarthost selection, local delivery and queuing?)

2022-09-08 Thread Jeremy Ardley


On 8/9/22 7:10 pm, rhkra...@gmail.com wrote:
To people who have familiarity with both postfix and exim4, is postfix 
really

easier (in a variety of senses) than exim4?  LIke to install, setup, and use?

I tried to set up postix back near the beginning of my Linux odyssey, maybe
sometime between 2000 and 2004 and eventually gave up and just went with an
MUA (kmail).



I can't say Postfix is 'better'  or 'easier' than any other mail server 
(sendmail excepted), but I can say that I rely on it to do what is 
expected and I'm now confident enough to run it in high risk applications.


For me, there are only a few packages that get into that grade - bind9 
and Kamailio/OpenSIPS are two. Perhaps openSSH as well?


With all packages it pays to read the official documentation many times 
and also work out what are reliable non-official sources. There is an 
awful lot of crud out there, either bad to start with, or out of date.


--
Jeremy



OpenPGP_signature
Description: OpenPGP digital signature


OT: Is postfix "easier" than exim4? (was: Re: Which MTA for from-based smarthost selection, local delivery and queuing?)

2022-09-08 Thread rhkramer
On Thursday, September 08, 2022 01:06:07 AM Jeremy Ardley wrote:
> On 8/9/22 12:29 pm, to...@tuxteam.de wrote:
> > On Wed, Sep 07, 2022 at 10:31:37PM +0200, Sébastien Hinderer wrote:
> >> Currently I am using exim4 as mail transport agent (MTA).
...
> >> solution, although I find exim4 really big and difficult to apprehend.
 
> It's incredibly easy using postfix sender_dependent_relayhost_maps

To people who have familiarity with both postfix and exim4, is postfix really 
easier (in a variety of senses) than exim4?  LIke to install, setup, and use?

I tried to set up postix back near the beginning of my Linux odyssey, maybe 
sometime between 2000 and 2004 and eventually gave up and just went with an 
MUA (kmail).

-- 
rhk

If you reply: snip, snip, and snip again; leave attributions; avoid HTML; 
avoid top posting; and keep it "on list".  (Oxford comma included at no 
charge.)  If you change topics, change the Subject: line. 

Writing is often meant for others to read and understand (legal agreements 
excepted?) -- make it easier for your reader by various means, including 
liberal use of whitespace and minimal use of (obscure?) jargon, abbreviations, 
acronyms, and references.

If someone else has already responded to a question, decide whether any 
response you add will be helpful or not ...

A picture is worth a thousand words -- divide by 10 for each minute of video 
(or audio) or create a transcript and edit it to 10% of the original.



Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-08 Thread Gregor Zattler
Hi Sébastien, debian users,
* Sébastien Hinderer  [2022-09-07; 22:31 +02]:
> (I am not subscribed to the list)
>
> Currently I am using exim4 as mail transport agent (MTA).
>
> I am looking for another one, because I would like to be able to
> configure the SMTP server to use based on the address I am using in the
>>From header. For instance, if I am sending from my personal account then
> I'd like to use one smarthost and SMTP configuration, but if I am
> sending from my work address, I would like the MTA to choose my work's
> SMTP server as its smarthost. Am I correct that exim4 does not allow for
> such a configuration? If it would, I think that would be my preferred
> solution, although I find exim4 really big and difficult to apprehend.

there is https://github.com/xundeenergie/exim4-multiaccount,
which worked for me, but I always felt uneasy because I did
not grok the configuration.

It's not updated since 2018.

> I was advised to use msmtp but, although it has the feature I am looking
> for, it misses two features of exim4 that I find useful: local e-mail
> delivery to users' maildirs and the ability to queue emails composed while
> the computer is off-line so that they get sent the next time the network
> becomes available.

I use exim4 now for local delivery only (think cron job
mails) and msmtp for delivery from my local account to
smarthosts.  There are no other users on my system=laptop.

Package msmtp features a queueing mechanism implemented via
shell scripts.  Its buried in the example directory of it's
documentation.  I set links from /usr/local/bin/msm... to
/usr/share/doc/msmtp/examples/msmtpq/msm... and use msmtpq
as sendmail:

$ lt /usr/local/bin/ | grep msm
lrwxrwxrwx 1 root root   43 Aug  8  2021 msmtpq -> 
/usr/share/doc/msmtp/examples/msmtpq/msmtpq
lrwxrwxrwx 1 root root   48 Aug  8  2021 msmtp-queue -> 
/usr/share/doc/msmtp/examples/msmtpq/msmtp-queue
lrwxrwxrwx 1 root root6 Aug  8  2021 msmtpQ -> msmtpq


It either sends email straight to the smarthost or queues
it.  There is not *automatic* queue maintenance nor
notification if mails were queued instead of sent.  There is
a log file though.  Next time you send another email the
queue will be emptied (if possible).

There also is a package "msmtp-mta" which I did *not*
install since it conflicts with exim4.  But I need exim4 for
local delivery.

In sum msmtp is configured for my single user and exim4 as a
system wide local delivery MTA.

For local delivery into maildirs I still use fetchmail.


Ciao; Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-



Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-08 Thread Sébastien Hinderer
Thanks.

I indeed found a blog post describing an implementation. I can't post
the URL here, sorry, because I did'nt keep it so it looked complex to
me. I felt completely intimidated, not daring to launch myself in such
an adventure. I may try to read exim4-s documentation, but frankly if I
can come up with a simpler solution, I think I'd really prefer that.

Sébastien.



Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-07 Thread Jeremy Ardley


On 8/9/22 12:29 pm, to...@tuxteam.de wrote:

On Wed, Sep 07, 2022 at 10:31:37PM +0200, Sébastien Hinderer wrote:

Dear all,

(I am not subscribed to the list)

Currently I am using exim4 as mail transport agent (MTA).

I am looking for another one, because I would like to be able to
configure the SMTP server to use based on the address I am using in the
>From header. For instance, if I am sending from my personal account then
I'd like to use one smarthost and SMTP configuration, but if I am
sending from my work address, I would like the MTA to choose my work's
SMTP server as its smarthost. Am I correct that exim4 does not allow for
such a configuration? If it would, I think that would be my preferred
solution, although I find exim4 really big and difficult to apprehend.

I've been mulling over it (and I want to stay with exim) and came to the
conclusion that it should be possible. But I haven't implemented it yet,
so take my conclusion with two fists of salt.

Cheers



It's incredibly easy using postfix sender_dependent_relayhost_maps

One option retaining exim4 is to use postfix as an outgoing mail gateway 
and forward to it from the exim4 instance.



--
Jeremy



OpenPGP_signature
Description: OpenPGP digital signature


Re: Which MTA for from-based smarthost selection, local delivery and queuing?

2022-09-07 Thread tomas
On Wed, Sep 07, 2022 at 10:31:37PM +0200, Sébastien Hinderer wrote:
> Dear all,
> 
> (I am not subscribed to the list)
> 
> Currently I am using exim4 as mail transport agent (MTA).
> 
> I am looking for another one, because I would like to be able to
> configure the SMTP server to use based on the address I am using in the
> >From header. For instance, if I am sending from my personal account then
> I'd like to use one smarthost and SMTP configuration, but if I am
> sending from my work address, I would like the MTA to choose my work's
> SMTP server as its smarthost. Am I correct that exim4 does not allow for
> such a configuration? If it would, I think that would be my preferred
> solution, although I find exim4 really big and difficult to apprehend.

I've been mulling over it (and I want to stay with exim) and came to the
conclusion that it should be possible. But I haven't implemented it yet,
so take my conclusion with two fists of salt.

Cheers
-- 
t


signature.asc
Description: PGP signature