这是一个创建于 3923 天前的主题,其中的信息可能已经有所发展或是发生改变。
具体配置如下:
send_mail_host = 'smtp.gmail.com'
send_mail_user = 'goodman'
send_mail_user_name = u'goodman bbs'
send_mail_pswd = '12345678'
send_mail_postfix = 'gmail.com'
get_mail_user = 'goodman'
charset = 'utf-8'
get_mail_postfix = 'gmail.com'
get_mail_host = 'smtp.gmail.com'
def send(sub, content, reciver = get_mail_user + get_mail_postfix):
send_mail_address = send_mail_user_name + '<' + send_mail_user + '@' + send_mail_postfix + '>'
msg = email.mime.text.MIMEText(content,'html',charset)
msg['Subject'] = email.Header.Header(sub,charset)
msg['From'] = send_mail_address
msg['to'] = to_adress = reciver
try:
stp = smtplib.SMTP('smtp.gmail.com',587)
stp.connect(send_mail_host)
stp.login(send_mail_user,send_mail_pswd)
stp.sendmail(send_mail_address,to_adress,msg.as_string())
stp.close()
return True
except Exception,e:
print(e)
return False
8 条回复 • 1970-01-01 08:00:00 +08:00
|
|
2
o618 2014-01-22 11:08:48 +08:00
有可能,试试看
|
|
|
3
66beta 2014-01-22 11:18:54 +08:00
ssl要的,phpmailer就需要设置才通
|
|
|
4
o618 2014-01-22 11:49:04 +08:00
|
|
|
5
109109 2014-01-22 12:44:22 +08:00 1
|
|
|
6
109109 2014-01-22 12:44:42 +08:00 1
|
|
|
7
109109 2014-01-22 12:51:46 +08:00
|
|
|
8
o618 2014-01-22 13:01:34 +08:00
|