Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
Add configs file
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoQi99 committed Sep 19, 2018
1 parent 03fe334 commit 411eb6b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 16 additions & 0 deletions src/configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# encoding='utf-8'
'''
Created on Sep 19, 2018
@author: QiZhao
@license: GNU GPLv3
@version: 0.1.7
'''
# twillo config
ACCOUNT_ID = ''
AUTH_TOKEN = ''
TWILIO_NUMBER = ''

# send_email config
FROM_ADDR = ""
PASSWORD = ""
14 changes: 7 additions & 7 deletions src/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from email.mime.text import MIMEText
import smtplib
from tool import Log_Write

import configs

def Send_sms(send_number, msg):
'''
Expand All @@ -31,9 +31,9 @@ def Send_sms(send_number, msg):
'''

# 从twilio上获取
account_sid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
auth_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
twilio_number = '+xxxxxxxxx'
account_sid = configs.ACCOUNT_ID
auth_token = configs.AUTH_TOKEN
twilio_number = configs.TWILIO_NUMBER

log_send_sms = ''
client = Client(account_sid, auth_token)
Expand Down Expand Up @@ -71,12 +71,12 @@ def Send_email(txt, to_addr_str, subject):
'example@qq.com 邮件发送失败,请检查你的账号是否有效或网络是否良好!\n'
'example1@qq.com,example2@qq.com 邮件发送成功!\n'
'''
from_addr = 'xxxxxxxxxxxx@qq.com' # 发件人的邮件地址
password = '**********' # 非QQ密码,应为SMTP服务授权码,可在QQ邮件设置的账户选项中获取
from_addr = configs.FROM_ADDR # 发件人的邮件地址
password = configs.PASSWORD # 非QQ密码,应为SMTP服务授权码,可在QQ邮件设置的账户选项中获取

msg = MIMEText(txt)
msg['Subject'] = subject # 邮件主题
msg['From'] = 'xxxxxxxxx@qq.com' # 使用QQ邮箱发送时,此处必须与from_addr一致
msg['From'] = configs.FROM_ADDR # 使用QQ邮箱发送时,此处必须与from_addr一致
# 使用其他邮箱的情况尚未测试
msg['To'] = to_addr_str
to_addr_list = to_addr_str.split(',') # ['example1@qq.com','example2@qq.com']
Expand Down

0 comments on commit 411eb6b

Please sign in to comment.