def sendmessage(tel_list,message_list):
appid =
appkey = " "
phone_numbers =tel_list
template_id = 294075
sms_sign = ""
ssender = SmsSingleSender(appid, appkey)
params = message_list
try:
result = ssender.send_with_param(86, phone_numbers[0],
template_id, params, sign=sms_sign, extend="",
ext="")
except HTTPError as e:
print(e)
except Exception as e:
print(e)
return result
def sendmail(str_toaddr,str_message):
msg_from = '' # 发送方邮箱
passwd = '' # 填入发送方邮箱的授权码
msg_to = str_toaddr # 收件人邮箱
subject = " " # 主题
content = str_message
msg = MIMEText(content,'html','utf-8')
msg['Subject'] = subject
msg['From'] = msg_from
msg['To'] = msg_to
try:
s = smtplib.SMTP_SSL("smtp.qq.com", 465)
s.login(msg_from, passwd)
s.sendmail(msg_from, msg_to, msg.as_string())
print("发送成功")
except s.SMTPExceptione:
print("发送失败")
finally:
s.quit()
return "ok"