Error: need RCPT command

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: