You can setup gmail in your settings.py

DEFAULT_FROM_EMAIL = 'your-email@your-domain'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'your-gmail-usern...@gmail.com'
EMAIL_HOST_PASSWORD = 'your-gmail-password'

And you can use the email_user() method of the models.User obejct:
http://docs.djangoproject.com/en/dev/topics/auth/

On Wed, Mar 30, 2011 at 5:53 AM, LIU Liang <mmhan...@gmail.com> wrote:

> Hello,
> I want to realize the verification of email when sign up. But I don't
> know how to send a email.
> for example with a account of gmail.
> I have tried the method following, but there's errors.
> Could anybody help?
>
> I create a django project, and add email configuration in settings.py.
> then
>    python manage.py shell
> In [1]: from django.core.mail import send_mail
> In [2]: send_mail('Subject', 'Body of the message.',
> 'from_usern...@gmail.com',['to_usern...@gmail.com'])
>
> but...
>
> >>> from django.core.mail import send_mail
> >>> send_mail('Subject', 'Body of message.', 'mmhan...@gmail.com',
> ['mmhancxt@gm
> ail.com'])
> Traceback (most recent call last):
>  File "<console>", line 1, in <module>
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 407,
> in send_ma
> il
>    connection=connection).send()
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 281,
> in send
>    return self.get_connection(fail_silently).send_messages([self])
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 179,
> in send_me
> ssages
>    new_conn_created = self.open()
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 144,
> in open
>    local_hostname=DNS_NAME.get_fqdn())
>  File "D:\Python27\lib\smtplib.py", line 239, in __init__
>    (code, msg) = self.connect(host, port)
>  File "D:\Python27\lib\smtplib.py", line 295, in connect
>    self.sock = self._get_socket(host, port, self.timeout)
>  File "D:\Python27\lib\smtplib.py", line 273, in _get_socket
>    return socket.create_connection((port, host), timeout)
>  File "D:\Python27\lib\socket.py", line 567, in create_connection
>    raise error, msg
> error: [Errno 10060]
> >>>
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
    *Green Tackle* - *Environmentally Friendly Fishing Tackle*
    www.GreenTackle.com <http://www.greentackle.com>

     Email: mi...@greentackle.com
     Phone: 971.270.2206
     Toll Free: 877.580.9165
     Fax: 503.946.3106

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to