[Answer]-Django sends email to some weird "m, m" address

1πŸ‘

βœ…

The trick is that Django is expecting a tuple of tuples in ADMINS, but you have actually only given a single tuple: the outer parentheses are effectively ignored, because in Python it is not the parens that define a tuple, but the comma.

The code in the mail_admins function tries to extract the emails from the setting by doing [a[1] for a in settings.ADMINS], so in your case it will take the second letter of the name and the second letter of the email address – presumably those both happen to be β€œm”.

Do this instead:

ADMINS = (('{name}', '{email@mycompany.com}'),)

Note the extra comma before the final close paren.

Leave a comment