Package: mailcalaid
mailcalaidA Python library/commands to provide aid to accomplish tasks related to mail and calendar.Installationpip install git+https://github.com/klesh/mailcalaid.gitUsageLibrariesholiday modulefromdatetimeimporttimedelta,datetimefrommailcalaid.cal.holidayimportNagerDateHolidayBookus_holiday_book=NagerDateHolidayBook(timedelta(hours=-7),"US")print("usa today:  is_holiday, name = ",us_holiday_book.check())usd=datetime(2023,1,16,0,0,0,0,us_holiday_book.timezone)print("usa ",usd,":  is_holiday, name = ",us_holiday_book.check(usd))# usa  2023-01-16 00:00:00-07:00 :  is_holiday, name =  (True, 'Martin Luther King, Jr. Day')print("usa ",usd,":  is_workhour = ",us_holiday_book.is_workhour(usd))# usa  2023-01-16 00:00:00-07:00 :  is_workhour =  Falseusd=datetime(2023,4,5,9,0,0,0,us_holiday_book.timezone)print("usa ",usd,":  is_holiday, name = ",us_holiday_book.check(usd))# usa  2023-04-05 09:00:00-07:00 :  is_holiday, name =  (False, '')print("usa ",usd,":  is_workhour = ",us_holiday_book.is_workhour(usd))# usa  2023-04-05 09:00:00-07:00 :  is_workhour =  TrueCLI ToolmaidaidManage your remote emailsHelppy-mmailcalaid.mailaidhelp[subcommand]Setup mail server / account$env:MAIL_PROTO="imap"$env:MAIL_HOST="imap.qq.com"$env:MAIL_PORT="993"$env:MAIL_USER="xxxxx@qq.com"$env:MAIL_PASSWD="???????"$env:MAIL_SSL="true"List mailboxes (imap only)# (imap only)py-mmailcalaid.mailaidmailboxesList messages# get first pagepy-mmailcalaid.mailaidlist# set page size to 100 and fetch the 2nd pagepy-mmailcalaid.mailaidlist--page-size1002Show message# show oldest messagepy-mmailcalaid.mailidshow1# show newest messagepy-mmailcalaid.mailidshow-1Backup messages# backup messages 1~20 from INBOX as `mbox` filepy-mmailcalaid.mailiddownload--id1--id-end20backup.mbox# backup all messages from "Sent Messages"py-mmailcalaid.mailid--mailbox"Sent Messages"download--allsent.mboxDelete messages# (imap only) delete all message in "Sent Messages"py-mmailcalaid.mailid--mailbox"Sent Messages"delete--all# keep certain amount of newest messages and delete the restpy-mmailcalaid.mailiddelete--keep700# delete messages before given datepy-mmailcalaid.mailiddelete--before"2023-01-01"# delete messages after given datepy-mmailcalaid.mailiddelete--after"2023-01-01"Debugging options# print debugging logpy-mmailcalaid.mailid--debug<command>...# readonly mode, swallow all writing/deleting operationspy-mmailcalaid.mailid--dry-run<command>...# specify target mailbox (imap only)py-mmailcalaid.mailid--mailbox"mailboxname"<command>...mail2botMonitor new messages that meet certain criterions and send http requests to your bot hook (Slack/Feishu, etc.)Step 1: Copy configuration folderexamples/mail2botto your local file system and set it up accordingmail2bot.iniis for setting up mail server, message filter and web bot configuration.mail2bot_state.iniis for storing the previous checking time.
Step 2: Test out>exportCONFIG_DIR=/path/to/mail2bot
>py-mmailcalaid.mail2bot--dry-run[2023-04-0220:35:45,817]__main__:startcheckingnewmailssince2023-03-2916:30:12+08:00[2023-04-0220:35:47,003]__main__:wouldnotifyfor2023-04-0201:59:01-07:00[apache/incubator-devlake]feat(domain):addissue_assigneesdomaintable(PR#4841)[2023-04-0220:35:48,494]__main__:wouldnotifyfor2023-04-0117:18:24-07:00Re:[apache/incubator-devlake][Feature][ConfigUI]Showingnotificationsinbrowserwhenablueprintfinishesrunning(Issue#2251)[2023-04-02 20:35:48,644] __main__: would notify for 2023-04-01 17:18:20-07:00 Re: [apache/incubator-devlake] [Feature][Infra] ApiCollectors to resume collected data from previous failed collection (Issue #3822)[2023-04-0220:35:48,818]__main__:wouldnotifyfor2023-04-0117:18:16-07:00Re:[apache/incubator-devlake][Feature][gitextractor]solutionneededforhttpsdisabledorgs(Issue#4392)[2023-04-0220:35:48,943]__main__:wouldnotifyfor2023-04-0117:18:13-07:00Re:[apache/incubator-devlake][Feature][BitBucket]SupportBitBucketserverversion(Issue#4568)[2023-04-0220:35:50,193]__main__:wouldnotifyfor2023-04-0105:34:08-07:00Re:[apache/incubator-devlake-helm-chart]feat:enableselectionofdefaultNginxingressvsgenericone.(PR#104)[2023-04-0220:35:50,624]__main__:wouldnotifyfor2023-04-0105:32:45-07:00Re:[apache/incubator-devlake-helm-chart]feat:enableselectionofdefaultNginxingressvsgenericone.(PR#104)[2023-04-0220:35:51,094]__main__:wouldnotifyfor2023-04-0103:45:12-07:00Re:[apache/incubator-devlake]fix:Fixfailingtests(PR#4840)[2023-04-0220:35:57,074]__main__:wouldnotifyfor2023-03-3117:17:39-07:00Re:[apache/incubator-devlake][Feature][UI]MorerobustvalidationofendpointURL(Issue#4199)[2023-04-0220:35:57,924]__main__:wouldnotifyfor2023-03-3115:05:17-07:00[apache/incubator-devlake]fix:Fixfailingtests(PR#4840)[2023-04-0220:36:01,294]__main__:wouldnotifyfor2023-03-3109:14:59-07:00[apache/incubator-devlake][Feature][SonarCubeConnection]AddsupportforSonarCloud(Issue#4838)[2023-04-0220:36:03,193]__main__:wouldnotifyfor2023-03-3107:34:14-07:00Re:[apache/incubator-devlake]feat(circleci):addcircleciplugin(PR#4803)[2023-04-0220:36:03,365]__main__:wouldnotifyfor2023-03-3107:32:20-07:00Re:[apache/incubator-devlake]feat(circleci):addcircleciplugin(PR#4803)[2023-04-0220:36:03,494]__main__:wouldnotifyfor2023-03-3106:21:43-07:00[apache/incubator-devlake]fix:ensureChangelogIDsarenumeric(PR#4835)[2023-04-0220:36:06,544]__main__:wouldnotifyfor2023-03-3103:40:01-07:00Re:[apache/incubator-devlake]Fixjsonargparsing(PR#4831)[2023-04-0220:36:06,694]__main__:wouldnotifyfor2023-03-3103:37:37-07:00Re:[apache/incubator-devlake]feat(config-ui):supportpluginazuredevops(PR#4504)[2023-04-0220:36:06,864]__main__:wouldnotifyfor2023-03-3103:34:09-07:00Re:[apache/incubator-devlake]feat(config-ui):supportpluginazuredevops(PR#4504)[2023-04-0220:36:07,484]__main__:wouldnotifyfor2023-03-3103:30:39-07:00[apache/incubator-devlake]Fixjsonargparsing(PR#4831)[2023-04-0220:36:07,964]__main__:wouldnotifyfor2023-03-3103:02:40-07:00Re:[apache/incubator-devlake][Feature][Docker]Dockerimagesbuiltfrom`main`(Issue#4785)[2023-04-0220:36:08,324]__main__:wouldnotifyfor2023-03-3102:54:46-07:00Re:[apache/incubator-devlake-helm-chart]feat:enableselectionofdefaultNginxingressvsgenericone.(PR#104)[2023-04-0220:36:11,194]__main__:wouldnotifyfor2023-03-3102:13:49-07:00[apache/incubator-devlake][Bug][customize]ErroroccurredwhenmappingfloattypefieldusingCustomizeplugin(Issue#4828)[2023-04-0220:36:11,314]__main__:wouldnotifyfor2023-03-3101:56:43-07:00[apache/incubator-devlake][Bug][convertIssueChangelogs]parsing"[90]":invalidsyntax(Issue#4827)[2023-04-0220:36:11,564]__main__:donecheckingnewmails,nextsincewouldbe2023-04-0220:35:45.817328Step 3: Go live>exportCONFIG_DIR=/path/to/mail2bot
>py-mmailcalaid.mail2bot