From 52b5651e344a5bdefa862a281c2d5a8ba74ff202 Mon Sep 17 00:00:00 2001 From: Brahmajit Das Date: Sat, 24 May 2025 01:52:19 +0530 Subject: imapfilter config. for now we have only setup for work email Signed-off-by: Brahmajit Das --- .imapfilter/config.lua | 133 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 .imapfilter/config.lua (limited to '.imapfilter/config.lua') diff --git a/.imapfilter/config.lua b/.imapfilter/config.lua new file mode 100644 index 0000000..a0b19ae --- /dev/null +++ b/.imapfilter/config.lua @@ -0,0 +1,133 @@ +-- The time in seconds for the program to wait for a mail server's response (default 60) +options.timeout = 120 + + +-- According to the IMAP specification, when trying to write a message to a +-- non-existent mailbox, the server must send a hint to the client, whether +-- it should create the mailbox and try again or not. However some IMAP +-- servers don't follow the specification and don't send the correct +-- response code to the client. By enabling this option the client tries to +-- create the mailbox, despite of the server's response. +options.create = true + +-- By enabling this option new mailboxes that were automatically created, +-- get also subscribed; they are set active in order for IMAP clients to +-- recognize them +options.subscribe = true + +-- Normally, messages are marked for deletion and are actually deleted when +-- the mailbox is closed. When this option is enabled, messages are +-- expunged immediately after being marked deleted. +options.expunge = true + +options.starttls = true + +options.hostnames = false + +-- Escapes problematic characters in passwords. +function sanitize_pwd(pwd) + -- Chomp off newline character that is sucked in from Password Store. + pwd = string.gsub(pwd, "\n", "") + + -- Escape backslash characters that exist in passwords. Need to escape the + -- escape characters at each 'level' where the password string is used + -- otherwise escape characters are lost. + -- + -- The slashes are escaped first. If they were escaped later then + -- characters escaped later would be escaped again. + pwd = string.gsub(pwd, '%\\', '\\\\') + + -- Escape double quote characters that exist in passwords. + pwd = string.gsub(pwd, '%"', '\\"') + + return pwd +end + +-- Gets password from pass +--status, password_suse = "testtest" +status, password_suse = pipe_from("pass show suse/imap_password") + +local suse = IMAP { + server = "imap.suse.de", + username = "bdas@mutt", + password = sanitize_pwd(password_suse), + ssl = "ssl3" +} + +--suse.INBOX:check_status() + +-- Solid Ground +local sg = suse.INBOX:contain_from("sg_noreply@suse.de") +sg:move_messages(suse["sg"]) + +-- DL APAC news +local dl_su_apac = suse.INBOX:contain_cc("DL-SU-APAC@suse.com") + + suse.INBOX:contain_to("DL-SU-APAC@suse.com") + + suse.INBOX:contain_from("DL-SU-APAC@suse.com") +dl_su_apac:move_messages(suse["DL-SU-APAC"]) + +-- DL india news +local dl_su_india = suse.INBOX:contain_cc("dl-su-india@suse.com") + + suse.INBOX:contain_to("dl-su-india@suse.com") + + suse.INBOX:contain_from("dl-su-india@suse.com") +dl_su_india:move_messages(suse["DL-SU-INDIA"]) +dl_su_india = suse.INBOX:contain_to("dl-su-india@suse.com") +dl_su_india:move_messages(suse["DL-SU-INDIA"]) + +-- l3-coord +local l3_cord = suse.INBOX:contain_from("l3-coord@suse.de") + suse.INBOX:contain_cc("l3-coord@suse.de") + + suse.INBOX:contain_to("l3-coord@suse.de") + suse.INBOX:contain_cc("critsit@suse.de") +l3_cord:move_messages(suse["l3-coord"]) + +-- bugzilla incoming emails +local bg = suse.INBOX:contain_cc("bugzilla_noreply@suse.com") + suse.INBOX:contain_from("bugzilla_noreply@suse.com") +bg:move_messages(suse["bg_replies"]) + +-- kernel suse mailing list +local kernel_suse = suse.INBOX:contain_cc("kernel@suse.de") + suse.INBOX:contain_to("kernel@suse.de") + + suse.INBOX:contain_from("kernel@suse.de") +kernel_suse:move_messages(suse["kernel-suse"]) + +-- Incoming messages from kbuild +local kbuild = suse.INBOX:contain_from("kbuild@suse.de") +kbuild:move_messages(suse["kbuild"]) + +-- sdi mailing list +local sdi = suse.INBOX:contain_from("sdi-team@suse.de") + suse.INBOX:contain_cc("sdi-team@suse.de") + + suse.INBOX:contain_to("sdi-team@suse.de") +sdi:move_messages(suse["sdi-team"]) + +-- devel mailing list +local devel = suse.INBOX:contain_cc("devel@suse.de") + suse.INBOX:contain_to("devel@suse.de") +devel:move_messages(suse["devel"]) + +-- Advert from OReilly, LinkedIn and Lenovo +local advert = suse.INBOX:contain_from("oreilly") + suse.INBOX:contain_from("lenovo") + + suse.INBOX:contain_from("linkedin") +advert:move_messages(suse["advert"]) + +-- DL linux all news +local dl_linux_all = suse.INBOX:contain_to("dl-linux-all@suse.com") + suse.INBOX:contain_cc("dl-linux-all@suse.com") + + suse.INBOX:contain_from("dl-linux-all@suse.com") +dl_linux_all:move_messages(suse["dl_linux_all"]) + +-- BCL news +local bcl_news = suse.INBOX:contain_body("BCL Monthly Newsletter") + suse.INBOX:contain_subject("BCL Monthly Newsletter") +bcl_news:move_messages(suse["bcl_news_letter"]) + +-- HR and pay slip notification +local hr_noreply = suse.INBOX:contain_from("no-reply@greythr.com") +hr_noreply:move_messages(suse["hr_noreply"]) + +-- jira notifications +local jira = suse.INBOX:contain_from("jira-sd@suse.com") + suse.INBOX:contain_from("jira@suse.com") +jira:move_messages(suse["jira"]) + +-- klp patches mailing list +local klp_patches = suse.INBOX:contain_cc("klp-patches@suse.de") + suse.INBOX:contain_to("klp-patches@suse.de") + + suse.INBOX:contain_from("klp-patches@suse.de") +klp_patches:move_messages(suse["klp-patches"]) + +-- Meeting invitaions +local invitaions = suse.INBOX:contain_subject("Invitation:") +invitaions:move_messages(suse["meeting invitaions"]) -- cgit v1.2.3