As far as I read, Django only supports sending mails using SMTP.
I would like to send Emails from my script in Django, but do not want to setup SMTP server (it's too complex for me, I'm a linux newbie).
Is it possible, to send mails in Django in the same way like I do it in PHP, without providing SMTP login, password and etc?
PHP uses sendmail on UNIX system to send emails. I guess at some point when you set up the system, this is, sendmail is configured.
There is an API to sendmail for Python, maybe it helps you. But there is a SMTP server involved in any case ;)
Postfix and Exim were built to deal with all of the problems associated with forwarding email from your host to the rest of the world. Your app speaks SMTP to them, and they turn around and speak SMTP with the destination. But they're very, very good at it.
There is nothing stopping you from doing a DNS lookup for the MX records of the email address you're sending to and connecting straight to that server and speaking SMTP to it. Nothing except that nagging voice that should be asking you "Is this really easier than apt-get install exim4?"
So how does PHP do it? By magic?
If you don't have an SMTP server, sign up for a GMail account and use that.
Your hosting provider might have set up the host and any possible login credentials for all the PHP pages on their machines. This would make it seem like none are required. Your hosting provider should be more than happy to give you the information. Try searching for SMTP in their FAQ, forum, and any welcome emails they sent. If your search does not turn anything up, ask them directly.
Once you have the information, you will want to add it to your settings.py file using these email settings:
# *** settings.py ***
#EMAIL_HOST = 'host here'
#EMAIL_PORT = 587
#EMAIL_HOST_USER = 'your user here'
#EMAIL_HOST_PASSWORD = 'your password'
#EMAIL_USE_TLS = True
Uncomment and use as many of these settings as you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With