Ho sbattuto la testa molto prima di rendersi conto che in realtà è abbastanza semplice:
aggiungere questo alla tua settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
DEFAULT_FROM_EMAIL = 'Whatever <[email protected]>'
anche assicurarsi che un nome di dominio completo (ad esempio mybox.example.com) è impostato sul server (how),
Poi è necessario disporre di queste linee nel vostro file /etc/postfix/main.cf :
myhostname = mybox.example.com
mydestination = localhost.server.com, localhost, example.com
Inoltre è necessario impostare una corretta record MX per il dominio (check here) nel server DNS (e nel tuo registrar, se si gestisce la ricerca DNS attraverso di voi li)
Se Django può essere configurato per usare un server SMTP, probabilmente potresti semplicemente installare postfix e puntare django a localhost: 25. – getWeberForStackExchange
Non capisco. Intendi inserire questo in settings.py EMAIL_HOST = 'localhost' EMAIL_PORT = 25? – toothie
Sì, esattamente. Supponendo che postfix sia impostato correttamente, penso che dovrebbe funzionare. Non ho familiarità con Django, ma a giudicare dalla [loro documentazione] (https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-EMAIL_PORT), quelle sono le impostazioni corrette. – getWeberForStackExchange