» For developing a website with Django, how can I use localhost as a functioning SMTP server?
For developing a website with Django, how can I use localhost as a functioning SMTP server?
|September 29, 2014
Posted by forumadmin
I’m developing a website with Django, and I’m currently working on the whole authentication setup, specifically the part where the user can use a password reset form that sends a one-time email with a link to use for resetting the password. However, if I try to use ‘localhost’ (currently my own personal machine) to send the email, the web server included with Django crashes with the message:
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
I did some research and figured out that to send email, I need to connect with an SMTP server, and my machine is apparently not an SMTP server. At least, not usually. Now, I want to note two things:
I am aware that I can use Gmail’s SMTP servers, and in fact, I have code in another program that does just that. However, I would prefer to use ‘localhost’ if possible. If I can’t, then I’ll just create another Gmail account and use that.
I am aware that Django provides several email backends, and in fact, I currently have the file-based backend implemented right now. That’s good enough to test the provided links and verify that they work, but I would like to see what the email would actually look like, with any formatting included in the email template.
So, how can I turn ‘localhost’ into an SMTP server, and one that Django will accept? Alternatively, if I can’t, then please let me know and I will take the alternate route of setting up another Gmail account to use.
More Related Questions
- Given a URL, how to encode a files contents as base64 with Python / Django? I am building a Django-based website, and am having trouble figuring out a decent way to email some larger PDFs and such to my users.
The files in question never touch our servers; […]
- send attachmant with chinese name to kindle fail in django I'm developing a django site to send ebooks to kindle by email. when the ebook name is in English, everything is ok,my kindle can recieve the ebook. However, if the ebook name is Chinese, […]
- Can I change the USERNAME_FIELD in Django 1.5 without creating a custom user? I am trying to use the email field in the default Django user model as the username. I am using Django 1.5 and I saw that the default user has a USERNAME_FIELD property.
In my project, I […]
- How to set email header X-Type with Django EmailMessage I need to set X-Type header for email, which sends with Django 1.4. I use default EmailMessage class from Django.
Would work something like this?
email = EmailMessage(title, body, sender, […]
- Is it possible to configure 2 email hosts using EmailMessage? I want to send an email from different email host depending on the status. Heres the pseudo-code
Currently using django send_mail and EmailMessage for the core.mail module
if status == […]
- Creating email templates with Django I want to send HTML-emails, using Django templates like this:
your account activated.
- Why use Django on Google App Engine? When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and […]
- Cannot send mail from remote server System.Net.Mail.SmtpException: Failure sending mail It drives me crazy. I'm trying for two days now. I'm trying to create a web service for sending e-mails. The code was working on a local machine. But when I pusblish it to a hosted remote […]
- Sending email through Gmail SMTP server with C# For some reason the accepted answer or any others don't work for me for "Sending email in .NET through Gmail". Why would it not work?
UPDATE: I have tried all the answers (accepted and […]
- Send email using GMail SMTP server from PHP page I am trying to send an email via GMail's SMTP server from a PHP page but I get this error:
authentication failure [SMTP: SMTP server does no support authentication (code: 250, […]