阿里云邮箱发html邮件

这段Python脚本用于从数据库获取数据并将其内容作为HTML邮件发送。它连接到MySQL数据库,执行SQL调用,然后使用SMTP_SSL通过阿里云邮箱服务器发送邮件。
摘要由CSDN通过智能技术生成
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import datetime
import MySQLdb
import os
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
#os.system('source /etc/profile')
import sys
import xlwt
import xlrd
import smtplib
from time import strftime, localtime
from datetime import timedelta, date
import calendar
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
#sys.path.append('/usr/lib64/python2.6/site-packages/cx_Oracle.so')

# 打开数据库连接
mydb = MySQLdb.connect("10.18.141.52","dba","xxxxxxx","ys" )

mycursor = mydb.cursor()
mycursor.execute('SET CHARACTER SET utf8;')
mycursor.execute('SET NAMES utf8;')
mycursor.execute('SET character_set_connection=utf8;')
sql2 = " CALL ys.pr_get_increament_report_by_plat_class1();"

try:
    mycursor.execute(sql2)
    results2 = mycur
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值