tags:

views:

12

answers:

1

Hi,

I'm trying to send email using php pear email package but I don't know how to set the headers correctly to send the content as html . I currently have :

$headers = array (
  'From' => $username,
  'To' => $bid_email,
  'Reply-To' => $seller_email,
  'Subject' => $subject,
  'MIME-Version:' => "1.0",
  'Content-type:' => "text/html; charset=iso-8859-1",

   );

$smtp = Mail::factory('smtp',
  array (
    'host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));
if (PEAR::isError($smtp)) {
    echo("

" . $smtp->getMessage() . "

"); } $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("

" . $mail->getMessage() . "

"); } else { echo("email was sent to $bid_email"); }

Using the above code the email is sent as html attachment file if I send it to a gmail address and it looks like a broken html content in aol email. Any help to set the headers properly would be highly appreciated .

A: 

I had a typo

$headers = array (
  'From' => $username,
  'To' => $bid_email,
  'Reply-To' => $seller_email,
  'Subject' => $subject,
  'MIME-Version' => "1.0",
  'Content-type' => "text/html; charset=iso-8859-1",

   );
Michael