How to use send_mail function.

19 views
Skip to first unread message

Chen Xu

unread,
Aug 4, 2014, 3:42:34 AM8/4/14
to django...@googlegroups.com
Hi Everyone,
I am trying to send emails from gmail, I know I can do it if I put the following in settings.py:

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'exa...@gmail.com'
EMAIL_HOST_PASSWORD = 'password'

But I wonder if I dont specify them, and call it in the following way.

send_mail('Subject here', 'Here is the message.', 'fr...@example.com',
        ['t...@gmail.com'], fail_silently=False, auth_user='example@gmail.com', auth_password='password').

It says connection refused. How do I fix this.

Thanks

--
⚡ Chen Xu

Andreas Kuhne

unread,
Aug 4, 2014, 4:05:44 AM8/4/14
to django...@googlegroups.com
Hi Chen,

Check this post:

I think you are missing the settings for secure SMTP (which google requires).

Regards,

Andréas


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACac-qbGz_g31Cah4bR9iRLwNMyQiwYh%2Bv81qbROY6%2BdwJOXxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages