• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

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: webmaster@example.com" . "\r\n" ."CC: somebodyelse@example.com";

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<steve@mycompany.com>";
$host = "localhost";
$username = "steve@muycompany.com";
$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.
0
steva
Asked:
steva
1 Solution
 
Eddie ShipmanAll-around developerCommented:
PHP's mail function and the Mail class that you see being used are not the same.
0
 
stevaAuthor Commented:
Ah!  Thanks.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now