PHP 5 Mail Functions

Introduction to PHP Mail

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


To make mail functions available, PHP requires an installed and running mail system. The program to use is defined by configuration settings in the php.ini file.


Mail functions are a core part of PHP. No installation is required to use these functions.

Runtime configuration

The behavior of the Mail function is affected by settings in the php.ini file.

Mail configuration options:

name default Description can be changed
SMTP "localhost" Windows Private: The DNS name or IP address of the SMTP server. PHP_INI_ALL
smtp_port "25" For Windows: SMTP port number. Available since PHP 4.3. PHP_INI_ALL
sendmail_from NULL For Windows: Specifies the "from" address used in emails sent by PHP. PHP_INI_ALL
sendmail_path NULL Unix-specific: Specifies the path of the sendmail program (usually /usr /sbin /sendmail or /usr /lib /sendmail). PHP_INI_SYSTEM

PHP Mail function

PHP : Indicates the earliest PHP version that supports this function.

PHP 5 Mail Functions

function description PHP
ezmlm_hash () Calculate the hash value required by the EZMLM mailing list system. 3
mail () Allows you to send email directly from the script. 3