Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 747231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:10:53+00:00 2026-05-14T14:10:53+00:00

Having some trouble sending properly formatted HTML e-mail from a PHP script. I am

  • 0

Having some trouble sending properly formatted HTML e-mail from a PHP script. I am running PHP 5.3.0 and Apache 2.2.11 on Windows XP Professional.

The output looks like this:

Agent Summary for Support on Tuesday April 20 2010=20
Ext. Name Time Volume
137 Agent Name 01:27:25 1
138 =09 00:00:00 0
139 =09 00:00:00 0

You see the =20 and =09 in there? If you look at the HTML you also see = signs being turned into =3D. I figure this is a character encoding issue as I read the following at Wikipedia:

ISO-8859-1 and Windows-1252 confusion

It is very common to mislabel text data with the charset label ISO-8859-1, even though the data is really Windows-1252 encoded. In Windows-1252, codes between 0x80 and 0x9F are used for letters and punctuation, whereas they are control codes in ISO-8859-1. Many web browsers and e-mail clients will interpret ISO-8859-1 control codes as Windows-1252 characters in order to accommodate such mislabeling but it is not standard behaviour and care should be taken to avoid generating these characters in ISO-8859-1 labeled content.

This looks like the problem but I don’t know how to fix. My code looks like this:

ob_start();
report_queue_summary($yesterday,$yesterday,$first_extension,$last_extension,$queue);
$body_report = ob_get_contents();
ob_end_clean();
$body_footer = "This is an automatically generated e-mail.";
$message = new Mail_mime();
$html = $body_header.$body_report.$body_footer;
$message->setHTMLBody($html);
$body = $message->get();
$extraheaders = array("From"=>"***redacted***","To"=>$recipient, "Subject"=>"Agent Summary for $yesterday [$queue]", "Content-type"=>"text/html; charset=iso-8859-1");
$headers = $message->headers($extraheaders);

# setup e-mail;
$host = "*********";
$port = "26";
$username = "*****";
$password = "*****";

# Send e-mail
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));

$mail = $smtp->send($recipient, $extraheaders, $body);

if (PEAR::isError($mail)) {
  echo("" . $mail->getMessage() . "");
 } else {
  echo("Message successfully sent!");
 } 

Is the problem that I’m using output buffering?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:10:53+00:00Added an answer on May 14, 2026 at 2:10 pm

    The problem is that you need the following header:

    Content-Transfer-Encoding: quoted-printable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble sending a file by ftp from my BizTalk 2006RC. The
I am having some trouble with foreign characters when sending an e-mail. Could someone
I am having some trouble sending values from one page to another using the
Having some trouble getting a screenscraper webservice up and running on a weblogic 10.3.3
I'm having some trouble sending $_FILES by cURL - the files get transferred alright
I'm having trouble with a particular version of Pocket IE running under Windows Mobile
I'm having trouble figuring out how to display some return JSON objects. My script
Having some trouble trying to put together a page where images are placed properly.
Having some trouble getting this query to work correctly. mysql_query(DELETE FROM `table` WHERE `id`
I'm having some trouble sending along more than one variable to the view. my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.