Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>
In a project, after executing a task, we can’t receive the set email. After exception capture, we find the following error in sending email:
smtplib.SMTPDataError: (503, b'Error: need RCPT command')
Abnormal recurrence
>>> cc_email = ['None']
>>> send_email(subject=subject, content=content, domain=domain, to_email=to_email, cc_email=cc_email)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/data/web/scripts/py/custom_send_email.py", line 43, in send_email
msg.send()
File "/usr/local/lib/python3.7/site-packages/django/core/mail/message.py", line 294, in send
return self.get_connection(fail_silently).send_messages([self])
File "/usr/local/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 110, in send_messages
sent = self._send(message)
File "/usr/local/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 126, in _send
self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n'))
File "/usr/local/lib/python3.7/smtplib.py", line 882, in sendmail
(code, resp) = self.data(msg)
File "/usr/local/lib/python3.7/smtplib.py", line 560, in data
raise SMTPDataError(code, repl)
smtplib.SMTPDataError: (503, b'Error: need RCPT command')
After checking the code, it turned out that a list containing “None” was obtained when obtaining the CC mailbox
Solution:
Will CC_ Email = [‘none ‘] to CC_ Email = none or CC_ Email = []
Similar Posts:
- [Solved] smtplib Sent Email Error: SMTPDataError: (554, ‘DT:SPM 163 smtp1
- [Solved] Python Error: CentOS failed to send mail without any error message
- [773]smtplib.SMTPServerDisconnected: Connection unexpectedly closed
- How to Solve Name Error: module ‘yagmail’ has no attribute ‘SMTP’
- Python Send Email Error: smtplib.SMTPException: SMTP AUTH extension not supported by server
- Python AttributeError: ‘unicode’ object has no attribute ‘tzinfo’
- [Solved] Djiango Create Migrations Error: query = query.decode(errors=’replace’) AttributeError: ‘str’ object has no attribute ‘decode’
- Django startup error: generator expression must be parentized
- Using Python HDFS module to operate Hadoop HDFS
- Django Run Error: RuntimeError: maximum recursion depth exceeded while calling a Python object