Prev | Current Page 483 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

You can change this default, as
is demonstrated in the next example.
Taking Advantage of PEAR: Mail and Mail_Mime
While it??™s possible to use the mail() function to perform more complex operations
such as sending to multiple recipients, annoying users with HTML-formatted e-mail,
or including attachments, doing so can be a tedious and error-prone process. However,
the Mail (http://pear.php.net/package/Mail) and Mail_Mime (http://pear.php.net/
package/Mail_Mime) PEAR packages make such tasks a breeze. These packages work
in conjunction with one another: Mail_Mime creates the message, and Mail sends it.
This section introduces both packages.
Installing Mail and Mail_Mime
To take advantage of Mail and Mail_Mime, you??™ll first need to install both packages. To
do so, invoke PEAR and pass along the following arguments:
414 CHAPTER 16 ?–  NE TWORKING
%>pear install Mail Mail_Mime
Execute this command and you??™ll see output similar to the following:
Starting to download Mail-1.1.13.tgz (17,527 bytes)
......done: 17,527 bytes
downloading Mail_Mime-1.3.1.tgz ...
Starting to download Mail_Mime-1.3.1.tgz (16,481 bytes)
...done: 16,481 bytes
install ok: channel://pear.php.net/Mail_Mime-1.3.1
install ok: channel://pear.php.net/Mail-1.1.13
Sending an E-mail with Multiple Recipients
Using Mime and Mime_Mail to send an e-mail to multiple recipients requires that you
identify the appropriate headers in an array.


Pages:
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495