1

I have an e-mail form that works fine on the staging server but not locally.

I received this error:

SMTPRecipientsRefused at /submit-foo/
{'': (555, '5.5.2 Syntax error. y4sm50402qad.14 - gsmtp')}

I read Python's documentation on the SMTPRecipientsRefused error:

All recipient addresses refused. The errors for each recipient are accessible through the attribute recipients, which is a dictionary of exactly the same sort as SMTP.sendmail() returns.

What do I need to do to solve this?

That 'gsmtp' bit might tell me that this is an issue with Gmail's SMTP server, which is what I have set up in localhost. A basic sendmail out of shell works fine, though.

Brendan
  • 868
  • 1
  • 16
  • 38

2 Answers2

2

The message wasn't being sent because it lacked a "to" e-mail address. This should have been set up in local_settings.py, but I did not do so.

Adding an e-mail address for it to go to caused it to work as expected!

Brendan
  • 868
  • 1
  • 16
  • 38
1

While using the djoser library for Django, I received an almost identical error "SMTPRecipientsRefused at /auth/register" with

Exception Value: {'': (555, '5.5.2 Syntax error. pe8sm51379679pdb.60 - gsmtp')}

I found clear this Stack Overflow reference 555 5.5.2 Syntax error. gmail's smtp noting "Google's SMTP requires you to format email addresses in the following way: Recipient Name ". Modifying my calling request to include a valid email was the solution:

curl -v -X POST http://127.0.0.1:8000/auth/register?format=json \
     --data 'username=djoser1&password=djoser&email=someone@domain.com' 
Community
  • 1
  • 1
cgeeb
  • 11
  • 1