View previous topic :: View next topic |
Author |
Message |
Strunzdesign n00b
Joined: 12 May 2004 Posts: 67 Location: Nuremberg - Germany
|
Posted: Fri Jan 20, 2017 10:05 pm Post subject: Easy way to put a mail into a maildir folder (dovecot)? |
|
|
Hi,
I successfully installed dovecot on my server to provide an IMAP-based storage folder. Until now, I'm using it just to archive all my mails here (I manually move them using my MUA, i.e., Kontact/KDE), so, until now, having dovecot for just IMAP access was sufficient.
Now, I'm looking for an easy method of injecting autogenerated emails into one of the maildir folders contolled by dovecot. These mails are generated by scripts, e.g., by using "mime-construct", in order to deliver notifications that a certain event happend. In my example, I have the VoIP PBX asterisk running on the same server and want an email to be created everytime someone talks on my phone box. My idea was to use "mime-constuct" and "nullmailer" to cooperate with dovecot, but I have no idea how to create an "easy" and "secure" setup involving as less components as possible.
My question:
Do I need a full-featured MTA such as postfix for it, or is there an easier method how to simply put a "hand-crafted" email into a well-defined maildir folder? The LMTP interface of dovecot looks promising, but as far as I understand the protocol of LMTP is does not use SMTP. I tested it using a TCP listener, as nullmailer is not able to access unix domain sockets, which are the default for dovecot and are considered the safest option to use LMTP.
I have no experience yet how to setup an MTA such as postfix, and it looks a bit overkill for my purpose. I just want to insert emails into my local storage folder... they are not designed to be sent somewhere. Any hint or advice is appreciated
Thank you, kind regards,
Florian |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Fri Jan 20, 2017 11:02 pm Post subject: |
|
|
Use procmail to direct mail to various folders. It has a bit of a learning curve, but once set-up, you can forget about it. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sat Jan 21, 2017 12:34 am Post subject: |
|
|
cboldt wrote: | Use procmail to direct mail to various folders. It has a bit of a learning curve, but once set-up, you can forget about it. |
cboldt, Strunzdesign ... an example of which was posted here in answer to a similar question recently.
best ... khay |
|
Back to top |
|
|
Strunzdesign n00b
Joined: 12 May 2004 Posts: 67 Location: Nuremberg - Germany
|
Posted: Sat Jan 21, 2017 1:31 pm Post subject: |
|
|
Hi,
thank you both for your replies! That thread khayyam referred to was new to me... seems that I missed it during my search. At first, I have to correct myself, I intended to write "procmail" in my question but somehow wrote "postfix".
As far as I understood how procmail works it is able to write directly to maildir-based folders, but that causes problems if those folders are managed by dovecot. In this case, dovecot would need some kind of a trigger that it updates its index. LMTP seems the way to go to keep the maildir folder under full control of dovecot.
Thus, I would try to setup the following setup:
a.) mime-construct -> nullmailer -> procmail -> dovecot via LMTP
or
b.) procmail with a handcrafted email via STDIN -> dovecot via LMTP
Method (b) seems to have a smaller footprint, so I'm going to start with that. Or did I miss something?
Regards,
Florian |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Sat Jan 21, 2017 2:38 pm Post subject: |
|
|
I run dovecot in mbox format, and it has no trouble keeping "up to date" with the mail strewing that procmail does. The MTA in my case happens to be postfix. The following chain just delivers the mail. I have a typical SPAM folder, plus another ten or so for various separate interests. A folder named "IN:system", for example, gets cronjob and system activity, and a folder named "IN:danfan" gets stuff from a particular listserv I subscribe to.
MTA -> procmail -> MailFolders
Separately from the mail delivery activity, dovecot serves the mail on demand.
From somewhere in the dovecot config ...
Code: | mail_location = mbox:~/mail/:INBOX=/var/spool/mail/%n |
procmail strews to various folders in ~/mail, and admits some to /var/spool/mail/%n.
Procmail acts on mail sent to INBOX by MTA, diverting/strewing it as directed. My mail reader is set to view the contents of ~/mail and INBOX, which is what dovecot is set to serve up when queried. |
|
Back to top |
|
|
Etal Veteran
Joined: 15 Jul 2005 Posts: 1931
|
Posted: Sat Jan 21, 2017 3:39 pm Post subject: |
|
|
Why procmail? Its syntax is really obtuse and not fault-tolerant.
If you already have Dovecot, you can emerge it with the "sieve" flag, and use its LDA: http://wiki.dovecot.org/LDA
Then, just pipe the messages you want delivered through /usr/libexec/dovecot/deliver -k
You can then enable and set up the sieve plugin: http://wiki.dovecot.org/Pigeonhole/Sieve
It's a more painless to set up, and it works hand-in-hand with dovecot.
Personally, I have my mail set up like this:
Code: | IMAP/POP3 --> fetchmail --> dovecot-lda ---> ~/.Maildir <---> dovecot (IMAP) <--mbsync--> remote maildirs
^ ^ ^
| | |
/sbin/sendmail (OpenSMTP) ----' v `---> IMAP Clients
Mutt |
(fetchmail mainly because it supports listening for IMAP IDLE and retrieve mail in real time)
_________________ “And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010 |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Sat Jan 21, 2017 4:31 pm Post subject: |
|
|
I like the dovecot-sieve suggestion. Thanks for the pointer. I never used that, have a fairly complex set of procmail recipes here so stick with that, inertia and all. |
|
Back to top |
|
|
Etal Veteran
Joined: 15 Jul 2005 Posts: 1931
|
Posted: Sat Jan 21, 2017 4:49 pm Post subject: |
|
|
You can always migrate incrementally, by setting the last procmail rule to pipe to LDA (That's what I did ) _________________ “And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010 |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|