larsmagne / make-mta

Set up an MTA will all bells and whistles
https://lars.ingebrigtsen.no/2020/03/25/so-you-want-to-run-your-own-mail-server/
13 stars 3 forks source link

Feature Request: Automatically save outgoing mail (SMTP) in Sent folder (IMAP) #9

Closed fitzsim closed 2 years ago

fitzsim commented 2 years ago

make-mta is great, thanks for writing it. I've deployed it successfully as an alternative to a proprietary mail service.

Some proprietary services (e.g., Gmail) have a nice feature whereby SMTP-outgoing mail is automatically stored in the user's "Sent" IMAP folder. I realize this is mixing MTA and MDA responsibilities, but it is convenient for users. I've had some scenarios with my MUA configuration where I sent a response to something and accidentally omitted the Gcc header, and the sent message was not saved.

I searched around and couldn't find a definitive tutorial for how to make a Dovecot/Exim installation work this way. I wonder if make-mta can clear this up (like it did the rest of the setup process).

larsmagne commented 2 years ago

I think this is basically the mail user agent responsibility -- I don't think there's any easy way to have the MTA determine which IMAP account it should put outgoing email into (in general, there may be several). If there's only one, that becomes trivial, but it still sounds a bit niche to me.

fitzsim commented 2 years ago

I think I have the trivial setup that you describe -- i.e., multiple Unix users, but each Unix user is authenticated using the same credentials to both Exim and Dovecot, and both those services are running on the same server -- but I still couldn't find a guide for how to set up the Gmail-like behaviour. Maybe the knowledge of who authenticated to it is not known to Exim after authentication has happened?

But yeah, I understand if this is too niche or may cause too much confusion if added to make-mta.sh. Feel free to close as wontfix. Thanks!

larsmagne commented 2 years ago

Exim does know the identity of the authenticated user, so it should be possible to do something like this -- but I don't really have a recipe.

But like I said, this is pretty niche, so I don't think this would be appropriate for make-mta.

(Gmail is the mail user agent here, not the MTA, so Gmail is behaving like other user agents -- putting things into outgoing mail boxes is the MUA business, usually.)

fitzsim commented 2 years ago

Yes, good point about Gmail-as-MUA, I agree when the HTML or JavaScript user interfaces are used.

That said, (I should have mentioned) I've only ever used Gmail via IMAP and SMTP, with a non-browser-based MUA. In that usage, there's some boundary-blurring communication between the SMTP server and the IMAP server that results in the same behaviour (server-side Sent-folder filing) as the browser-based MUAs'.

I'll try to make sure my MUA is configured correctly in all cases. If I do end up wanting/figuring out a recipe for how to implement this behaviour, I'll post it here for posterity.

Thanks for discussing!