In this section, you??™ll learn how to send e-mail using PHP??™s popular
mail() function, including how to control headers, include attachments, and carry out
other commonly desired tasks.
This section introduces the relevant configuration directives, describes PHP??™s
mail() function, and concludes with several examples highlighting this function??™s
many usage variations.
Configuration Directives
There are five configuration directives pertinent to PHP??™s mail() function. Pay close
attention to the descriptions because each is platform-specific.
SMTP = string
Scope: PHP_INI_ALL; Default value: localhost
The SMTP directive sets the Mail Transfer Agent (MTA) for PHP??™s Windows platform
version of the mail function. Note that this is only relevant to the Windows platform
because Unix platform implementations of this function are actually just wrappers
around that operating system??™s mail function. Instead, the Windows implementation
depends on a socket connection made to either a local or a remote MTA, defined by
this directive.
sendmail_from = string
Scope: PHP_INI_ALL; Default value: NULL
The sendmail_from directive sets the From field of the message header. This parameter
is only useful on the Windows platform. If you??™re using a Unix platform, you must
set this field within the mail function??™s addl_headers parameter.
412 CHAPTER 16 ?– NE TWORKING
sendmail_path = string
Scope: PHP_INI_SYSTEM; Default value: the default sendmail path
The sendmail_path directive sets the path to the sendmail binary if it??™s not in the
system path, or if you??™d like to pass additional arguments to the binary.
Pages:
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492