This article mainly introduces how to install sendmail in Ubuntu, and the reasons for the slow sending of php mail after sendmail is enabled and the solution. For more information, see. If you need to use the mail () function of php to send emails, you need to install the sendmail component on the server. this is also introduced in the mail () function section of the php Manual. Then
Install the sendmail command in Ubuntu:
The code is as follows:
Sudo apt-get install sendmail
After installation, start the sendmail service:
The code is as follows:
Sudo service sendmail start
With sendmail support, you can use the mail () function in php to send emails.
The reason for the slow speed of mail () sending in php is that DNS resolution is slow, and it is often because the hostname of the server is not a real domain name that can be resolved.
The code is as follows:
Sudo vim/etc/hosts
Then press the I key to modify the code. Add localhost. localdomain and your host alias in section 127.0.0.1. after the modification, press Esc to exit the editing state, and then enter ': wq' to save and exit.
Finally, restart the sendmail service:
The code is as follows:
Sudo service sendmail restart
The above is all the content of this article. I hope you will like it.
Please take a moment to share your article with your friends or leave a comment. Thank you for your support!