How to use procmail to forward mail to a specific IMAP folder?

General discussions and other topics.
9 posts Page 1 of 1
by tbessie » Wed Feb 28, 2018 11:37 pm
Hey there folks...

For years now, I've been using procmail to take incoming mail and place it into specific local folders in my shell account based on specific words in the subject, the sender, the original target email address (I tag my email based on whom I've given it to), etc., which I later read using Pine.

This is fine, but it means that I can't access these folders easily from a mobile app.

What I have been thinking of is to use procmail, instead, to place incoming mail into separate IMAP folders. I can definitely create IMAP folders at will on the mail server, but I can't seen to figure out what to do in procmail to route incoming mail to them. The documentation doesn't talk about this, and I can't find a Linux utility program that can do this. I can forward the mail to another address, but that's not the same thing. What I want is to take an incoming mail and place it in a known, named IMAP folder on Sonic's mail server.

I can't use the free extra mailboxes I have, since each mailing is an entire IMAP tree structure, with a separate login and password, which isn't what I want. I want to use my main email account, but just add extra IMAP inboxes to it, and route incoming mail to them.

I asked regular Sonic support how to do this, and they said they believe it's possible, but they didn't know how.

Anyone have any ideas on how to do this?

- Tim
by kgc » Thu Mar 01, 2018 10:54 am
Tim, something like this. $DEFAULT is your Inbox, so ${DEFAULT}.spam/ would be "INBOX.spam" in IMAP. Since bolt still mounts the mail spools directly you just "cd $MAIL" and take a look around.

Please note the trailing slash which identifies the destination as a Maildir folder. Procmail will make it for you if it doesn't exist.

Code: Select all


#delivers to INBOX.spam
:0
* ^Subject: SPAM
${DEFAULT}.spam/

#delivers to nested folder INBOX.spam.also
:0
* ^Subject: ALSO SPAM
${DEFAULT}.spam.also/

Kelsey Cummings
System Architect, Sonic.net, Inc.
by tbessie » Thu Mar 01, 2018 12:21 pm
Kelsey - so does $DEFAULT point to the IMAP server and folder, or does it refer to the mounted source that IMAP accesses? I'd want to do it strictly via the server, not assume that they're available via the filesystem.

- Tim
by kgc » Thu Mar 01, 2018 2:22 pm
tbessie wrote:Kelsey - so does $DEFAULT point to the IMAP server and folder, or does it refer to the mounted source that IMAP accesses? I'd want to do it strictly via the server, not assume that they're available via the filesystem.
Procmail runs with direct access to the mailspool in a way that cooperates with the IMAP servers and cannot deliver messages directly via IMAP.
Kelsey Cummings
System Architect, Sonic.net, Inc.
by tbessie » Thu Mar 01, 2018 2:30 pm
kgc wrote:
tbessie wrote:Kelsey - so does $DEFAULT point to the IMAP server and folder, or does it refer to the mounted source that IMAP accesses? I'd want to do it strictly via the server, not assume that they're available via the filesystem.
Procmail runs with direct access to the mailspool in a way that cooperates with the IMAP servers and cannot deliver messages directly via IMAP.
Do you suppose it will always remain that way (eg. with the new shell server)? I'm hoping so, as I'd like to be able to depend on that.

- Tim
by kgc » Fri Mar 02, 2018 10:19 am
tbessie wrote:
kgc wrote:
tbessie wrote:Kelsey - so does $DEFAULT point to the IMAP server and folder, or does it refer to the mounted source that IMAP accesses? I'd want to do it strictly via the server, not assume that they're available via the filesystem.
Procmail runs with direct access to the mailspool in a way that cooperates with the IMAP servers and cannot deliver messages directly via IMAP.
Do you suppose it will always remain that way (eg. with the new shell server)? I'm hoping so, as I'd like to be able to depend on that.

- Tim
For the foreseeable future, yes. Supporting procmail does cause some challenges for us but is also something we are committed to support.
Kelsey Cummings
System Architect, Sonic.net, Inc.
by tbessie » Fri Mar 02, 2018 10:43 am
kgc wrote:
tbessie wrote:
kgc wrote:
Procmail runs with direct access to the mailspool in a way that cooperates with the IMAP servers and cannot deliver messages directly via IMAP.
Do you suppose it will always remain that way (eg. with the new shell server)? I'm hoping so, as I'd like to be able to depend on that.

- Tim
For the foreseeable future, yes. Supporting procmail does cause some challenges for us but is also something we are committed to support.
I can't remember who, either you or Dane, mentioned that procmail can use a lot of resources or something along those lines - is that the issue?

- Tim
by kgc » Fri Mar 02, 2018 12:01 pm
tbessie wrote: I can't remember who, either you or Dane, mentioned that procmail can use a lot of resources or something along those lines - is that the issue?
No, not really. It is more a function of that supporting procmail complicates or limits our ability to make technical decisions on how the mail platform works as a whole. But don't worry about it, we're unlikely to ever completely remove support for procmail.
Kelsey Cummings
System Architect, Sonic.net, Inc.
by tbessie » Fri Mar 02, 2018 12:03 pm
kgc wrote:
tbessie wrote: I can't remember who, either you or Dane, mentioned that procmail can use a lot of resources or something along those lines - is that the issue?
No, not really. It is more a function of that supporting procmail complicates or limits our ability to make technical decisions on how the mail platform works as a whole. But don't worry about it, we're unlikely to ever completely remove support for procmail.
Good to hear! (about it not going away) - thanks!

- Tim
9 posts Page 1 of 1

Who is online

In total there are 42 users online :: 0 registered, 0 hidden and 42 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 42 guests