当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > PHP Mail
The mail() function allows you to send emails directly from a script.
mail()函数用于使用脚本发送邮件
For the mail functions to be available, PHP requires an installed and working email system. The program to be used is defined by the configuration settings in the php.ini file.
要使用邮件函数,要求具有一个邮件系统。所使用的程序在php.ini文件中设定。
The mail functions are part of the PHP core. There is no installation needed to use these functions.
本函数库作为 PHP 内核的一部分,不用安装就能使用。
The behavior of the mail functions is affected by settings in the php.ini file.
这些函数的行为受 php.ini 的影响。
Mail configuration options:
邮件函数配置选项
Name 名称 | Default 默认值 | Description 说明 | Changeable 可修改范围 |
---|---|---|---|
SMTP | "localhost" | Windows only: The DNS name or IP address of the SMTP server 仅Windows:SMTP服务器的名称或IP地址 | PHP_INI_ALL |
smtp_port | "25" | Windows only: The SMTP port number. Available since PHP 4.3 仅Windows:SMTP端口。自PHP 4.3 | PHP_INI_ALL |
sendmail_from | NULL | Windows only: Specifies the "from" address to be used in email sent from PHP 仅Windows:发件人地址 | PHP_INI_ALL |
sendmail_path | NULL | Unix systems only: Specifies where the sendmail program can be found (usually /usr/sbin/sendmail or /usr/lib/sendmail) 仅Unix:邮件发送程序(通常是/usr/sbin/sendmail或 /usr/lib/sendmail) | PHP_INI_SYSTEM |
PHP: indicates the earliest version of PHP that supports the function.
PHP:最早支持这些函数的PHP版本
Function 函数 | Description 说明 | PHP |
---|---|---|
ezmlm_hash() | Calculates the hash value needed by the EZMLM mailing list system 计算EZMLM邮件列表系统所需的hash值 | 3 |
mail() | Allows you to send emails directly from a script 直接从脚本发送邮件 | 3 |
None.无