python发送邮件问题 20
环境说明:oracle11.2.0.3RACredhat6.5enterprisex64postfix-2.6.6-2.2.el6_1.x86_64Python2.6.6...
环境说明:
oracle 11.2.0.3 RAC
redhat6.5 enterprise x64
postfix-2.6.6-2.2.el6_1.x86_64
Python 2.6.6
内网有台邮件服务器192.168.1.3可以外发邮件(已经测试可以成功发送邮件到企业邮箱)
在数据库192.168.1.5(节点一)上面telnet 邮件服务器 25端口 可以成功telnet并成功发送邮件
在数据库192.168.1.5(节点一)写python脚本发送数据库日志到企业邮箱
脚本如下:
#!/usr/bin/python
#coding=gbk
#created by zhangsan
#2015/07/20
import os
import sys
import smtplib
FROM_USER='zhangsan@monitor.com'
SMTP_SERVER='192.168.1.3'
EMAIL_USER='zhangsan'
EMAIL_PASSWD='password'
TO_USERS=['lisi@163.com']
def mysendmail(fromaddr,toaddrs,subject,body):
server=smtplib.SMTP(SMTP_SERVER)
server.login(EMAIL_USER,EMAIL_PASSWD)
for toaddr in toaddrs:
msg = 'From: %s/nTo: %s/nSubject: %s/n/n%s/n' % (fromaddr, toaddr, subject, body)
server.sendmail(fromaddr,toaddr,msg)
server.quit()
def load(fname='/home/qiuqiu/test.log'):
fp=open(fname)
log=fp.read()
fp.close()
return log
body=load()
print body
subject='this is a test mail'
mysendmail(FROM_USER,TO_USERS,subject,body)
在数据库192.168.1.5(节点一)执行脚本报错信息:
Traceback (most recent call last):
File "./sendmail.py", line 31, in <module>
mysendmail(FROM_USER,TO_USERS,subject,body)
File "./sendmail.py", line 17, in mysendmail
server.login(EMAIL_USER,EMAIL_PASSWD)
File "/usr/lib64/python2.6/smtplib.py", line 552, in login
raise SMTPException("SMTP AUTH extension not supported by server.")
smtplib.SMTPException: SMTP AUTH extension not supported by server.
邮件服务器192.168.1.3日志如下:
Jul 26 22:53:37 localhost postfix/smtpd[26563]: connect from RAC01[192.168.1.5]
Jul 26 22:53:37 localhost postfix/smtpd[26563]: lost connection after EHLO from RAC01[192.168.1.5]
Jul 26 22:53:37 localhost postfix/smtpd[26563]: disconnect from RAC01[192.168.1.5]
希望能够得到大家的帮助!在此感谢!
kevin
联系邮箱:qrcg92@foxmail.com 展开
oracle 11.2.0.3 RAC
redhat6.5 enterprise x64
postfix-2.6.6-2.2.el6_1.x86_64
Python 2.6.6
内网有台邮件服务器192.168.1.3可以外发邮件(已经测试可以成功发送邮件到企业邮箱)
在数据库192.168.1.5(节点一)上面telnet 邮件服务器 25端口 可以成功telnet并成功发送邮件
在数据库192.168.1.5(节点一)写python脚本发送数据库日志到企业邮箱
脚本如下:
#!/usr/bin/python
#coding=gbk
#created by zhangsan
#2015/07/20
import os
import sys
import smtplib
FROM_USER='zhangsan@monitor.com'
SMTP_SERVER='192.168.1.3'
EMAIL_USER='zhangsan'
EMAIL_PASSWD='password'
TO_USERS=['lisi@163.com']
def mysendmail(fromaddr,toaddrs,subject,body):
server=smtplib.SMTP(SMTP_SERVER)
server.login(EMAIL_USER,EMAIL_PASSWD)
for toaddr in toaddrs:
msg = 'From: %s/nTo: %s/nSubject: %s/n/n%s/n' % (fromaddr, toaddr, subject, body)
server.sendmail(fromaddr,toaddr,msg)
server.quit()
def load(fname='/home/qiuqiu/test.log'):
fp=open(fname)
log=fp.read()
fp.close()
return log
body=load()
print body
subject='this is a test mail'
mysendmail(FROM_USER,TO_USERS,subject,body)
在数据库192.168.1.5(节点一)执行脚本报错信息:
Traceback (most recent call last):
File "./sendmail.py", line 31, in <module>
mysendmail(FROM_USER,TO_USERS,subject,body)
File "./sendmail.py", line 17, in mysendmail
server.login(EMAIL_USER,EMAIL_PASSWD)
File "/usr/lib64/python2.6/smtplib.py", line 552, in login
raise SMTPException("SMTP AUTH extension not supported by server.")
smtplib.SMTPException: SMTP AUTH extension not supported by server.
邮件服务器192.168.1.3日志如下:
Jul 26 22:53:37 localhost postfix/smtpd[26563]: connect from RAC01[192.168.1.5]
Jul 26 22:53:37 localhost postfix/smtpd[26563]: lost connection after EHLO from RAC01[192.168.1.5]
Jul 26 22:53:37 localhost postfix/smtpd[26563]: disconnect from RAC01[192.168.1.5]
希望能够得到大家的帮助!在此感谢!
kevin
联系邮箱:qrcg92@foxmail.com 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏20(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询