123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- from email.mime.text import MIMEText
- from email.utils import formataddr
- import smtplib
- class Push(object):
- '''消息推送'''
- def __init__(self):
- pass
-
- def send(self, message:str):
- '''you must implement it and send message'''
- pass
- class SMSPush(Push):
- '''短信推送'''
-
- def __init__(self):
- pass
- def send(self, message:str):
- pass
- class EmailPush(Push):
- '''邮件推送'''
-
- def __init__(self):
- pass
- def send(self, message:str):
- mailserver = "smtp.yoqi.me"
- username = "service@yoqi.me"
- password = ""
- msg = MIMEText("域名快到期了")
- msg['Subject'] = "【域名到期提醒】"
- msg['From'] = "service@xx"
- msg['To'] = "xx@qq.com"
- try:
- s = smtplib.SMTP(mailserver)
- s.login(username, password)
- s.send_message(msg)
- s.quit()
- except Exception as e:
- print(e)
- class AppPush(Push):
- '''App推送'''
- def __init__(self):
- pass
- def send(self, message:str):
- pass
- if __name__ == "__main__":
- pass
|