PHP 5 Mail Functions

The mail() function allows you to send emails directly from a script.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.The mail functions are part of the PHP core. There is no installation needed to use these functions.

Runtime Configuration

The behavior of the mail functions is affected by settings in php.ini : -

NameDefaultDescriptionChangeable
mail.add_x_header"0"Add X-PHP-Originating-Script that will include UID of the script followed by the filename. For PHP 5.3.0 and abovePHP_INI_PERDIR
mail.logNULLThe path to a log file that will log all mail() calls. Log include full path of script, line number, To address and headers. For PHP 5.3.0 and abovePHP_INI_PERDIR
SMTP"localhost"Windows only: The DNS name or IP address of the SMTP serverPHP_INI_ALL
smtp_port"25"Windows only: The SMTP port number. For PHP 4.3.0 and abovePHP_INI_ALL
sendmail_fromNULLWindows only: Specifies the "from" address to be used when sending mail from mail()PHP_INI_ALL
sendmail_path"/usr/sbin/sendmail -t -i"Specifies where the sendmail program can be found. This directive works also under Windows. If set, SMTP, smtp_port and sendmail_from are ignoredPHP_INI_SYSTEM

PHP 5 Mail Functions

FunctionDescription
ezmlm_hash()Calculates the hash value needed by EZMLM
mail()Allows you to send emails directly from a script