$ sudo service sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
$ sudo yum install postfix
Check the version below
$ postconf mail_version
mail_version = 2.6.6
This time 2.6.6 is included
$ sudo alternatives --config mta
There are 2 programs'mta'To provide.
Select command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail
2 /usr/sbin/sendmail.postfix
Press Enter to select the current[+]Or enter the selection number
Enter 2 to switch to postfix
$ sudo chkconfig sendmail off
$ chkconfig --list sendmail
sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off
$ sudo chkconfig --add postfix
$ sudo chkconfig postfix on
$ chkconfig --list postfix
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Disable sendmail autostart, enable postfix autostart
$ sendmail [email protected]
From:[email protected]
To:[email protected]
Subject:Test transmission
It is a test transmission
.
Check if an email has been sent to [email protected]
If you get an error like postdrop: warning: unable to look up public / pickup: No such file or directory
, take action below.
$ sudo service postfix restart
Shutting down postfix: [FAILED]
Starting postfix: [ OK ]
setting.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 = 'Sender name<[email protected]>'
....
Add the following
myhostname = mybox.example.com
mydestination = localhost.server.com, localhost, example.com
The part of example.com describes the domain name of the outgoing email address
Install Postfix and send an email | Today as well python - How do you configure Django to send mail through Postfix? - Stack Overflow
Recommended Posts