Home >Backend Development >PHP Problem >What to do if php smtp fails to send email
php The solution to the failure of smtp to send emails is to enable and configure sendmail or postfix on Linux. You can use sendmail to send emails in php.
Recommended: "PHP Video Tutorial"
Specific questions:
php fails to send emails using smtp, prompting that it cannot connect to the host
Using php smtp to send emails, the local test can be successfully sent, but when placed on the server, it prompts Trying to smtp.163.com:25
Error: Cannot connenct to relay host smtp.163.com Error: php_network_getaddresses: gethostbyname failed. errno=0 (0) Error: Cannot send email to zhuqingwen86@163.com ,fsockopen pfsockopen没有被禁用allow_url_fopen = On
Solution:
Enable and configure sendmail or postfix on Linux.
PHP is the abbreviation of the English hypertext preprocessing language Hypertext Preprocessor. PHP is an HTML embedded language. It is a scripting language that is embedded in HTML documents and is executed on the server side. The language style is similar to C language and is widely used.
The first version was released in 1995 as Personal Home Page Tools (PHP Tools). Lerdorf wrote some documents introducing the program. And PHP1.0 was released! In this version, simple functions such as guest book and visitor counter are provided.
In the future, more and more websites are using PHP, and there are strong requests to add some features. For example, loop statements, array variables, etc.; after new members joined the development team, Rasmus Lerdorf released PHP/FI to the public on June 8, 1995, hoping to speed up program development and find errors through the community.
This released version is named PHP 2. It already has some prototypes of PHP, such as Perl-like variable naming, form processing functions, and the ability to be embedded into HTML for execution. The program syntax is also similar to Perl, with more restrictions, but it is simpler and more flexible.
PHP/FI added support for MySQL, and has since established PHP's position in dynamic web development. By the end of 1996, there were 15,000 websites using PHP/FI.
The above is the detailed content of What to do if php smtp fails to send email. For more information, please follow other related articles on the PHP Chinese website!