Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
lywly committed May 6, 2022
1 parent 1221d8d commit b83ace9
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 4,410 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

*.pyc
/__pycache__/*
/dist/*
4 changes: 2 additions & 2 deletions BIT_Mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def main():
BIT_mail = imaplib.IMAP4(host=Imap_url, port=Port)
try:
BIT_mail.login(User, Passwd)
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' 登录成功,账户密码正确,定时任务已启动')
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' 验证成功,账户密码正确,定时任务已启动')
except Exception as e:
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' 登录失败')
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' 验证失败,请重新检查登录信息')
print("ErrorType : {}, Error : {}".format(type(e).__name__, e))
BIT_mail.logout()

Expand Down
40 changes: 40 additions & 0 deletions BIT_Mail.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['BIT_Mail.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=["tzdata","tzdata.zoneinfo.Asia"],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)

exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='BIT_Mail',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None , icon='favicon.ico')
11 changes: 6 additions & 5 deletions Mail_Push_Core/keywds_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ def kc_load():
def kc_delete():
try:
os.remove('cache.txt')
print('---------------------------------')
print('| |')
print('| 关键词缓存已清理 |')
print('| |')
print('---------------------------------')
print(' ---------------------------------')
print(' | |')
print(' | 关键词缓存已清理 |')
print(' | 关键词缓存已清理 |')
print(' | |')
print(' ---------------------------------')
except:
pass
9 changes: 5 additions & 4 deletions Mail_Push_Core/mail_summary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import email
import time
from email.header import decode_header, make_header

from Mail_Push_Core.Wechat_push import push
Expand Down Expand Up @@ -54,17 +55,17 @@ def mail_summary(Imap_url, Port, User, Passwd, Date_range, Sendkeys):
Subject = Subject_raw.replace('\r\n', '')
From = str(make_header(decode_header(my_msg['From'])))
# To = str(make_header(decode_header(my_msg['To'])))
# Date = time.strftime("%Y-%m-%d %H:%M:%S",
# time.localtime(email.utils.mktime_tz(email.utils.parsedate_tz(my_msg['Date']))))
Date = time.strftime("%Y-%m-%d %H:%M:%S",
time.localtime(email.utils.mktime_tz(email.utils.parsedate_tz(my_msg['Date']))))

All_Data = All_Data + '-----------------------------------\n'
All_Data = All_Data + f"主题: {Subject}" + "\n"
All_Data = All_Data + f"发件人: {From}" + "\n"
# All_Data = All_Data + f"Date: {Date}" + "\n"
# All_Data = All_Data + f"Content: {Content}" + "\n"
All_Data = All_Data + f"Date: {Date}" + "\n"

push(All_Data, Sendkeys)

print('<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>')
BIT_mail.close()
print('Mailbox closed.')
BIT_mail.logout()
Expand Down
7 changes: 5 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

### 功能
1. 可添加`关键词`进行`监测`,发现相关邮件将`推送`到设定平台
2. 邮箱信息`汇总`推送到设定平台,目前有`自建推送平台`设置、PushPlus[^1]推送设置
2. 可将邮箱信息定时`汇总`推送到设定平台
2. 目前支持`自建推送平台`设置、PushPlus[^1]推送设置
3. 关键词监测`时间间隔`与信息汇总`推送时间`均可`自定义`
4. 监测时间范围自定义:`今日``7日内`

### How to use
- 配置文件模板`config_template.ini`中对各项参数作了详细备注,请仔细阅读

- 基于`Python=3.9`,相关依赖列于[requirements.txt](./requirements.txt)
- 配置文件模板[`config_template.ini`](./config_template.ini)中对各项参数作了详细备注,请仔细阅读
- 必填项为 `User` `Passwd`
- 如需添加关键词自动监测,需填写 `Keywords`项,程序将在Terminal中显示运行结果
- 如需将监控结果与邮件汇总推送到微信,需填写 `push_plus_sendkey` 项,或自建推送通道
Expand Down
Binary file removed Release/BIT_Mail.exe
Binary file not shown.
Binary file removed Release/BIT_Mail_Monitor.zip
Binary file not shown.
Loading

0 comments on commit b83ace9

Please sign in to comment.