Enable PHP's mail() function in Ubuntu and solve the problem of slow email sending_PHP tutorial

WBOY
Release: 2016-07-13 10:00:04
Original
938 people have browsed it

Enabling PHP's mail() function in Ubuntu and solving the problem of slow email sending

This article mainly introduces how to install sendmail under Ubuntu, and after enabling sendmail , the reasons and solutions for PHP’s slow email sending, friends in need can refer to it.

If you need to use PHP's mail() function to send emails, you need to install the sendmail component on the server to support it. This is also introduced in the mail() function part of the PHP manual. Then in

Command to install sendmail under 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 the support of sendmail, you can use the mail() function to send emails in php.

Generally, the reason why sending emails using mail() in PHP is slow is due to slow DNS resolution, and it is often because the hostname of the server is not a real resolvable domain name.

The code is as follows:


sudo vim /etc/hosts

Then press the i key, and then you can modify the code. Add localhost.localdomain and your host alias in the 127.0.0.1 section. After making the changes, press the Esc key to exit the editing state, then enter ‘:wq’ to save and exit.

Finally restart the sendmail service:

The code is as follows:


sudo service sendmail restart

The above is the entire content of this article, I hope you all like it.

Please take a moment to share the article with your friends or leave a comment. We will sincerely thank you for your support!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/975119.htmlTechArticleEnabling php’s mail() function in Ubuntu and solving the problem of slow email sending This article mainly introduces to you the How to install sendmail under Ubuntu, and after enabling sendmail, php sends email...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template