Latest web development tutorials

PHP Mail Function

PHP Mail Profile

mail () function allows you to send e-mail directly from a script.


For mail function is available, PHP mail system needs to be installed and running. I want to use is set by the php.ini configuration file definition.


Mail functions are part of the PHP core. No installation needed to use these functions.

Runtime Configuration

Behavior Mail functions is affected by settings in php.ini file by.

Mail configuration options:

名称 默认 描述 可更改
SMTP "localhost" Windows 专用:SMTP 服务器的 DNS 名称或 IP 地址。 PHP_INI_ALL
smtp_port "25" Windows 专用:SMTP 端口号。自 PHP 4.3 起可用。 PHP_INI_ALL
sendmail_from NULL Windows 专用:规定在由 PHP 发送的电子邮件中使用的 "from" 地址。 PHP_INI_ALL
sendmail_path NULL Unix 系统专用:规定 sendmail 程序的路径(通常 /usr/sbin/sendmail 或 /usr/lib/sendmail)。 PHP_INI_SYSTEM

PHP Mail Function

PHP: indicates theearliest version of PHP that supports the function.

函数 描述 PHP
ezmlm_hash() 计算 EZMLM 邮件列表系统所需的散列值。 3
mail() 允许您从脚本中直接发送电子邮件。 3

PHP Mail constants