获得502,b'Bad praram in comand - >邮件ERRO,同时使用Python发送邮件

时间:2016-08-26 09:30:23

标签: python python-2.7 python-3.x email smtplib

您好我在使用python发送邮件时遇到502错误 代码:

import smtplib

 from email.mime.text 

import MIMEText

title = 'My title'
msg_content = '<h2>{title} > <font color="green">OK</font> </h2>\n'.format(title=title)
message = MIMEText(msg_content, 'html')

msg_full = message.as_string()

server = smtplib.SMTP(host='192.168.1.46',port=25)
server.set_debuglevel(True)

server.sendmail('nikhil@gmail.com',['ngaude@yahoo.com'],
            msg_full)
server.quit()




Error :
send: 'ehlo [127.0.1.1]\r\n'
reply: b'250 Welcome [192.168.62.51], Its nice to meet you\r\n'
reply: retcode (250); Msg: b'Welcome [192.168.62.51], Its nice to meet     you'
send: 'mail FROM:<nikhil@gmail.com>\r\n'
reply: b'502 Bad praram in comand ->mail FROM:<nikhil@gmail.com><-   \r\n'
reply: retcode (502); Msg: b'Bad praram in comand ->mail FROM:    <nikhil@gmail.com><-'
send: 'rset\r\n'
reply: b'250 OK\r\n'
reply: retcode (250); Msg: b'OK'
Traceback (most recent call last):
File "/home/nikhil/Desktop/YYYY/ZZZ/send_email.py", line 14,   in <module>
msg_full)
File "/usr/lib/python3.4/smtplib.py", line 778, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
smtplib.SMTPSenderRefused: (502, b'Bad praram in comand ->mail FROM:     <nikhil@gmail.com><-', 'nikhil@gmail.com')

邮件服务器正常运行。我可以通过同一邮件服务器使用Java发送电子邮件。

我哪里出错。

0 个答案:

没有答案