Q:

SMTPRecipientsRefused in Django send email

I'm trying to send email thru my Django app. I have this in my local_settings.py:
EMAIL_HOST = 'smtp.privateemail.com'
EMAIL_HOST_USER = 'support@mydomain.com'
EMAIL_HOST_PASSWORD = 'myPassword'
EMAIL_PORT = 587
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True

I have this in my views.py:
send_mail(
    subject="Subject here",
    message="Hello.",
    from_email=settings.EMAIL_HOST_USER,
    recipient_list=["someone@gmail.com],
    fail_silently=False,
)

But when the send_mail() executes, I get this error:
{u'someone@gmail.com': (504, '5.5.2 <webmaster@localhost>: Sender address rejected: need fully-qualified address')}

Why? And how do I make my app send emails properly?

A:

The error message says that it needs a fully qualified address. Basically, the domain part should be a fully qualified domain name, like mydomain.com, whereas you are using localhost.
Send the email from your actual domain address and it should be accepted.

One more thing. You will also need to authenticate your domain name so that Gmail knows you actually own it. Otherwise Gmail will either mark emails sent by your domain as spam or will just blacklist you and reject all mails from your domain.
Domain authentication is a rather vast topic. Gmail has published some guidelines about sending mail which is a good starting point. See the Authentication & Identification section to find out more.

