Linux server View whether PHP supports mail () function method

PHP’s Mail function can be used to send emails. For example, check whether the Linux server PHP supports the Mail function?

How to check whether PHP supports the Mail function

There are many ways to check whether PHP supports the Mail function on the Linux system:

1, you can use the PHP probe to test;

2, you can also view through the exists function;

3, use the phpinfo() function to view;

Note: For security reasons, Alibaba Cloud bans TCP port 25 by default. If you need to use the mail service, you can apply for unblocking: TCP 25 port unblocking application

These three methods for sharing code notes:< /p>

Method 1:Test with PHP probe

The PHP probe is specifically used to detect the configuration information of the website Linux server. The main functions include server environment detection, server performance detection, PHP component support detection, PHP configuration parameters, MYSQL connection test, MAIL sending test, and function support. You can use PHP probes to basically view all configuration information of the Linux server.

Directly download the PHP probe (such as Yahei probe), upload it to the root directory of the website, and access the probe file to query the server information. Please download the probe from Baidu by yourself.

Method 2:Check if the exists function supports the mail function

Create a PHP file on the local computer and name it test. php, copy the following code into the php file:

if (function_exists('mail')) {

echo "Support mail() function!";
}
else
echo "The mail() function is not supported!";
?>

Upload the test.php file to your server root directory, and then visit: your domain name/test.php interface to check whether mail() is supported function.

Method Three:Use the phpinfo() function to check whether the mail function is supported

Same as Method Two, create locally A php file, named test.php, copy and save the following code into the php file:

 php

phpinfo();
?>

Upload the test.php file to your server root directory, and then visit: your domain name/test.php interface to check whether mail() is supported function.

To detect whether PHP supports the mail function, the above three methods are actually the same, but the function name is different.

Link: https://mp.weixin.qq.com/s/5PVw4q6LYfjJBuE69jpfJg

if (function_exists('mail') ) {

echo "Support mail() function!";
}
else
echo "The mail() function is not supported!";
?>

php

phpinfo();
?>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5113 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.