-- 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") status, password_mailbox = pipe_from("pass show mailbox.org/pass") local suse = IMAP { server = "imap.suse.de", username = "bdas@mutt", password = sanitize_pwd(password_suse), ssl = "ssl3" } local mailbox = IMAP { server = "imap.mailbox.org", username = "listout@mailbox.org", password = sanitize_pwd(password_mailbox), ssl = "ssl3" } local dmarc_listout = mailbox.INBOX:contain_subject("Report Domain: listout.xyz") dmarc_listout:move_messages(mailbox["dmarc_reports"]) dmarc_listout:mark_seen(all_messages) local kernel_mentees = mailbox.INBOX:contain_cc("linux-kernel-mentees") + mailbox.INBOX:contain_to("linux-kernel-mentees") + mailbox.INBOX:contain_from("linux-kernel-mentees") kernel_mentees:move_messages(mailbox["linux-kernel-mentees"]) local kernel_bpf = mailbox.INBOX:contain_cc("bpf") + mailbox.INBOX:contain_to("bpf") + mailbox.INBOX:contain_from("bpf") kernel_bpf:move_messages(mailbox["kernel-bpf"]) local gentoo_dev = mailbox.INBOX:contain_cc("lists.gentoo.org") + mailbox.INBOX:contain_to("lists.gentoo.org") + mailbox.INBOX:contain_from("lists.gentoo.org") gentoo_dev:move_messages(mailbox["gentoo-dev"]) local syzbot = mailbox.INBOX:contain_cc("syzbot") + mailbox.INBOX:contain_from("syzbot") + mailbox.INBOX:contain_to("syzbot") + mailbox.INBOX:contain_subject("syzbot") + mailbox.INBOX:contain_cc("syzkaller-bugs") + mailbox.INBOX:contain_from("syzkaller-bugs") + mailbox.INBOX:contain_to("syzkaller-bugs") + mailbox.INBOX:contain_subject("syzkaller-bugs") syzbot:move_messages(mailbox["syzbot"]) local message_to_delete = mailbox["linux-kernel-mentees"]:is_older(30) + mailbox["dmarc_reports"]:is_older(30) + mailbox["gentoo-dev"]:is_older(100) + mailbox["INBOX/GitHub"]:is_older(60) + mailbox["syzbot"]:is_older(100) + mailbox["kernel-bpf"]:is_older(300) message_to_delete:move_messages(mailbox["Trash"]) --suse.INBOX:check_status() -- Meeting invitaions local invitaions = suse.INBOX:contain_subject("Invitation:") + suse.INBOX:contain_subject("Canceled event") invitaions:move_messages(suse["meeting_invitation"]) -- Solid Ground local sg = suse.INBOX:contain_from("sg_noreply@suse.de") sg:move_messages(suse["sg"]) -- l3-coord local l3_cord = suse.INBOX:contain_from("l3-coord") + suse.INBOX:contain_cc("l3-coord") + suse.INBOX:contain_to("l3-coord") + suse.INBOX:contain_cc("critsit") + suse.INBOX:contain_cc("critsit") l3_cord:move_messages(suse["l3-coord"]) -- bugzilla incoming emails local bg = suse.INBOX:contain_cc("bugzilla_noreply") + suse.INBOX:contain_from("bugzilla_noreply") 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"]) local l3_client = suse.INBOX:contain_from("l3-clients") + suse.INBOX:contain_cc("l3-clients") + suse.INBOX:contain_to("l3-clients") l3_client:move_messages(suse["l3-clients"]) -- 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") + suse.INBOX:contain_from("classpass") + suse.INBOX:contain_from("oktopost") advert:move_messages(suse["advert"]) -- SUSE verse local suse_verse = suse.INBOX:contain_from("SUSEverse Weekly") suse_verse:move_messages(suse["suse_verse"]) -- 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"]) -- autobuild local autobuild = suse.INBOX:contain_from("autobuild@suse.de") autobuild:move_messages(suse["autobuild"]) -- suse loyalty local loyalty = suse.INBOX:contain_from("channels@loyalty.suse.com") + suse.INBOX:contain_from("SUSE Partner Loyalty Platform") loyalty:move_messages(suse["loyalty"]) -- 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"]) -- GitLab local gitlab = suse.INBOX:contain_to("gitlab") + suse.INBOX:contain_cc("gitlab") + suse.INBOX:contain_from("gitlab") gitlab:move_messages(suse["gitlab"]) -- suseverse local suseverse = suse.INBOX:contain_subject("SUSEverse") suseverse:move_messages(suse["SUSEverse"])