Enable the PHP mail () function in Ubuntu and resolve the slow sending of mail _php tutorial

Source: Internet
Author: User

Enable the PHP mail () function in Ubuntu and troubleshoot slow sending of mail


This article mainly introduces the method of installing SendMail under Ubuntu, as well as the reason and solution of the slow sending of the mail after the SendMail is enabled, the small partners who need it can refer to it.

If you need to use the PHP mail () function to send mail, it is necessary for the server to install the SendMail component to support, this is in the PHP manual in the Mail () function section is also described. And then in

To install the SendMail command 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 SendMail support, you can send mail in PHP with the Mail () function.

Generally cause in PHP with mail () to send the message slow reason, is the DNS resolution is slow, and often because the server's hostname 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, and then press ESC to exit the edit state, then enter ': Wq ' to save and exit.

Finally restart the next SendMail service:

The code is as follows:


sudo service sendmail restart

The above is the whole content of this article, I hope you can enjoy.

Please take a moment to share the article with your friends or leave a comment. We would be grateful for your support!

http://www.bkjia.com/PHPjc/975119.html www.bkjia.com true http://www.bkjia.com/PHPjc/975119.html techarticle Enable the PHP mail () function in Ubuntu and resolve the slow sending of messages this article mainly introduces you to the method of installing SendMail under Ubuntu, as well as enabling SendMail, PHP to send mail ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.