PHP Mail Functions

About This Index
This page is the PHP Mail Functions index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn how mail() hands a message to the mail system, what headers do, and how to avoid header injection on /php/mail. Use this page when you need a specific function such as mail() or ezmlm_hash().
Start with mail()—then read ezmlm_hash() only if you work with an EZMLM mailing list on an older PHP version.
mail() returns true when the local mail system accepts the message. It needs sendmail_path (Linux, macOS) or SMTP settings (Windows) in php.ini to send anything. ezmlm_hash() was removed in PHP 8.0.
How to Call a PHP Mail Function
Both helpers are global functions—call them directly. mail() takes the recipient, subject, message, and optional headers, and returns a bool:
$accepted = mail(
'[email protected]',
'Order 1042 shipped',
'Your order has shipped.',
['From' => '[email protected]', 'Reply-To' => '[email protected]']
);
var_dump($accepted); // bool: accepted, not delivered
// PHP 7 and earlier only (removed in PHP 8.0)
// echo ezmlm_hash('[email protected]'); // int from 0 to 52 PHP Mail Functions Table
All function guides in this PHP tutorial series (2 tutorials in 2 categories).
Send mail
1 functionSend a plain-text email from PHP. The function returns true when the mail system accepts the message, which is not the same as delivered.
EZMLM helper
1 functionA small helper for EZMLM mailing lists. It was removed in PHP 8.0, so it applies to older PHP versions only.
| Function | Description | Tutorial |
|---|---|---|
ezmlm_hash() | Get the EZMLM hash of an email address for subscriber file names. | Try it |
Frequently Asked Questions
Start with mail()
Open the main guide—syntax, examples, and FAQs.
6 people found this page helpful
