HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
lefcha
imapfilter
C2015–2025
lefcha / imapfilter

imapfilter

IMAP mail filtering utility

14Distinct people
16Mentions
0Explicit recommenders
938GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

IMAP mail filtering utility

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year16 dated mentions

Observed mentions: 2015-08-18 02:24:02 UTC to 2025-07-03 12:39:35 UTC.

012342015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC202
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC202
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC404
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC303
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202

What Hacker News says

16 sources
> My aim was to configure my home's heating to switch off when my family is away and turn back on when we return. This is achieved with home assistant, a popular open-source home automation platform, with location/presence notifications from mobile devices. To do this, the home assistant server needs to be accessible from the internet, as mobile devices must communicate with it remotely. Does it really need to be accessible from the internet? I've never used Home Assistant so maybe what follows would not work, but how about: • Your mobile device could upload the location/presence notifications to a server outside of your LAN, such as virtual machine at an inexpensive hosting service like Hetzner or Amazon Lightsail. Something on your LAN could poll that and talk to the Home Assistant server. • Your mobile device could email the notificati
Read the rest
ons to you. Something on your LAN could monitor your email and process the notifications. A good tool for that is imapfilter [1]. [1] https://github.com/lefcha/imapfilter
In Home Assistant can not be secured for internet access
If you just need email processing locally, I have found imapfilter to be quite nice. You can script it in Lua. Personally I went a bit overboard with it and implemented a simple TCP server in node which queries GitLab APIs based on the email metadata and moves Mails into Folders based on assignees, Labels etc. So letting do imapfilter the heavy IMAP stuff, calling node via tcp and using the response to sort based on it. [0]: https://github.com/lefcha/imapfilter
In IMAP API – self hosted daemon to access IMAP and SMTP accounts via HTTP API
Yup - https://github.com/lefcha/imapfilter "IMAPFilter is a mail filtering utility. It connects to remote mail servers using the Internet Message Access Protocol (IMAP), sends searching queries to the server and processes mailboxes based on the results. It can be used to delete, copy, move, flag, etc. messages residing in mailboxes at the same or different mail servers. The 4rev1 and 4 versions of the IMAP protocol are supported."
In Pimutils: The coreutils of personal information management
If you're looking to consolidate your email the best way is imapfilter https://github.com/lefcha/imapfilter I use this LUA script (this is the Jinja2 template so obviously you'll need to substitute the portions in {{ }} with your real values. It runs on an hourly cronjob on my server and sucks down all the mail from Gmail and another account and then puts it in my main inbox via IMAP (not forwarding) so you don't have to worry about opportunistic transport encryption. It also does not mess with the headers which forwarding emails invariably does. -- crontab -e -- 0 * * * * /usr/local/bin/imapfilter function main () -- See 'man imapfilter_config' for an explanation of -- imapfilter options and functions. -- Some config examples: -- https://github.com/lefcha/imapfilter/blob/master/samples/config.lua --
Read the rest
https://gist.github.com/dylanwh/408810 -- http://www.npcglib.org/~stathis/blog/2012/07/09/linux-task-sorting-mail-with-imapf… -- General Options options.timeout = 120 options.subscribe = true -- Accounts {%- for v in ACCOUNTS | from_json %} local {{ v.serverName }} = IMAP { server = '{{ v.server }}', username = '{{ v.username }}', password = '{{ v.password }}', ssl = '{{ v.ssl }}' } {%- endfor %} -- GMAIL -- Gmail behaves differently to normal imap. With a normal imap acccount -- you can simply use move_messages(). Google stores both inbox -- and sent email in the "[Gmail]/All Mail" folder. An email sent to yourself -- from the same email address exists as a single email and is visible in -- the Inbox and Sent box. If you delete the inbox mail then the sent mail -- is also deleted. Thus it is only safe to delete mail once both the Inbox -- and Sent box is copied. -- Only go ahead and copy inbox/sent/spam from gmail if I have received -- some Inbox email. if (gmail['Inbox']:check_status() > 0) then inbox_mail = gmail["Inbox"]:select_all() inbox_copy_success = inbox_mail:copy_messages({{ PRIMARY }}['Gmail Inbox']) sent_mail = gmail['[Gmail]/Sent Mail']:select_all() sent_copy_success = sent_mail:copy_messages({{ PRIMARY }}['Gmail Sent']) spam_mail = gmail["[Gmail]/Spam"]:select_all() spam_mail:move_messages({{ PRIMARY }}['Gmail Spam']) -- Only clear the All Mail folder if we were successful in moving -- our Inbox and Sent mail. Note: move_messages is supposed to return -- booleans for copying the messages and then marking them as deleted. -- For some reason the mark for deletion return value is 'nil'. -- This may need to be [Gmail]/Bin or [Gmail]/Trash check your account! if (inbox_copy_success and sent_copy_success) then print('Safe to delete both inbox and sent') move_inbox = inbox_mail:move_messages(gmail['[Gmail]/Trash']) move_sent = sent_mail:move_messages(gmail['[Gmail]/Trash']) if (move_inbox and move_sent) then print('Emptying bin'); bin_mail = gmail['[Gmail]/Trash']:select_all() bin_mail:delete_messages() end end end {%- if SECONDARY != '' %} -- {{ SECONDARY }} -- Only go ahead and copy inbox/sent/spam from {{ SECONDARY }} if I have received -- some Inbox email. if ({{ SECONDARY }}['Inbox']:check_status() > 0) then inbox_results = {{ SECONDARY }}['Inbox']:select_all() inbox_results:move_messages({{ PRIMARY }}['{{ SECONDARY }} Inbox']) sent_results = {{ SECONDARY }}['Sent']:select_all() sent_results:move_messages({{ PRIMARY }}['{{ SECONDARY }} Sent']) spam_results = {{ SECONDARY }}['Junk']:select_all() spam_results:move_messages({{ PRIMARY }}['{{ SECONDARY }} Spam']) end {%- endif %} end main()
In Meli email client, pre-alpha release

Showing the 15 most recent of 16 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.