Can you send the whole traceback? Name resolution errors indicate an issue with DNS reachability, or a domain name incorrectly entered somewhere. I'm assuming that you are running the shell on the same server that is running your Django instance? You should be able to do the following on the server where Django is running:
$ python manage.py shell >>> import socket >>> # checks if name resolution is working at all >>> socket.gethostbyname('www.google.com') '74.125.20.105' >>> # note you may get a different IP address >>> >>> # check if your email host value is resolvable >>> socket.gethostbyname("mail.xxxxxx.ir") Traceback (most recent call last): File "<console>", line 1, in <module> gaierror: [Errno -5] No address associated with hostname >>> Obviously I received an error here since I used the masked value you provided. You should get an IPv4/IPv6 address back, or an error similar to the one you posted. You can also do a quick check if you have shell or command prompt access available on your server outside of Python: $ nslookup www.google.com Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: Name: www.google.com Address: 74.125.239.112 Name: www.google.com Address: 74.125.239.114 Name: www.google.com Address: 74.125.239.113 Name: www.google.com Address: 74.125.239.116 Name: www.google.com Address: 74.125.239.115 $ nslookup mail.xxxxxx.ir Server: 127.0.1.1 Address: 127.0.1.1#53 ** server can't find mail.xxxxxx.ir: NXDOMAIN An NXDOMAIN response means that the domain is either typed incorrectly, or just doesn't exist out on the wild Internet (or wherever your DNS server recursively looks for you) That command should work on Windows and most Linux distributions (some Linux systems include the 'host' command as an alternative if BIND tools are installed). The output may be formatted differently but should provide similar information. The full traceback for the error will likely be most helpful, though. -James On Thu, Jan 8, 2015 at 12:08 AM, Hossein Rashnoo <mhr1...@gmail.com> wrote: > Hi > I use this settings to send email: > > settings.py > EMAIL_HOST = "mail.xxxxxx.ir" > EMAIL_PORT = "25" > EMAIL_HOST_USER = "xx...@xxx.ir" > EMAIL_HOST_PASSWORD = "xxxxxxxx" > EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' > DEFAULT_FROM_EMAIL = 'xx...@xxx.ir' > > and in python shell: > from django.core.mail import send_mail > send_mail('test', 'hello', 'xx...@xxx.ir', ['myem...@gmail.com']) > > And its successfully sent But when i use that two line code in view, i got > this error: > gaierror at /userforget/ > > [Errno -3] Temporary failure in name resolution > > > Please help me. > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@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/6aaaeaac-dc68-477a-b2d7-7b2821097c36%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/6aaaeaac-dc68-477a-b2d7-7b2821097c36%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@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/CA%2Be%2BciUUKDBbGUOCN2D1QeSKsd6D6jT6gT%2BWnuwn6%3DgEqFvUxA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.