PHP Mail

I see from the PHP manual that the headers for the mail are just a string with a CRLF between each header element::

$headers = "From:" . "\r\n" ."CC:";

But I've been using some code I copied from somewhere that makes the headers an array, and I'm just wondering why or how that works:

$from = "sender<>";
$host = "localhost";
$username = "";
$password = "early237";
$headers = array ('From' => $from,
        'To' => $To,
        'Subject' => $Subject);
$smtp = Mail::factory('smtp',
        array ('host' => $host,
            'auth' => true,
            'username' => $username,
            'password' => $password));
$mail = $smtp->send($To, $headers, $Body);

Thanks for any enlightenment.
Who is Participating?
Eddie ShipmanAll-around developerCommented:
PHP's mail function and the Mail class that you see being used are not the same.
stevaAuthor Commented:
Ah!  Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.