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

  • SEARCH
  • Home
  • 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 5944897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:36:18+00:00 2026-05-22T16:36:18+00:00

I’m using the latest version of PEAR mail_mime module and I’m running into a

  • 0

I’m using the latest version of PEAR mail_mime module and I’m running into a strange issue. When attaching HTML images to the email, the text portion stops working properly. What I mean by “not work properly” is that if I try to view the message as text in Thunderbird (or view the message in PINE), it doesn’t display what I have set as the “text” portion of the email; It tries to parse the HTML information in a text readable fashion. Everything in the HTML portion works as expected.

Here’s my slimmed down code:

//Headers
$headers['From'] = "from@address.com";
$headers['To'] = "to@address.com";
$headers['Subject'] = "A MIME Email";

//Text Portion
$text = "This is the text portion.";

//HTML Portion
$html = "<html><body><p><img src='image.png' />This is the HTML portion.</p></body></html>";

//Set up the MIME email
$mime = new Mail_mime(array('eol' => "\r\n"));
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addHTMLImage("/path/to/image.png", "image/png");

//Prepare the message to be sent
$body = $mime->get();
$headers = $mime->headers($headers);

//Send the message via SMTP
$mail_obj =& Mail::factory('smtp', array('host' => 'smtp.server.com', 'port' => 25));
$mail_obj->send("to@address.com", $headers, $body);

If I comment out the addHTMLImage line, the text portion of the email works as expected and I can see the content I’ve set for a non-HTML view. However, if I uncomment out the line, the text portion fails. Looking at the source of my message, I can see the text part is always there.

Here is the part of the message source that is relevant to this question:

Date: Thu, 26 May 2011 10:39:24 -0500 (CDT)
From: From Address <from@address.com>
Subject: A MIME Email
To: to@address.com
Message-id: <20110526153924.0C12120697@smtp.server.com>
MIME-version: 1.0
Content-type: multipart/alternative;
 boundary="=_e107860f353617028a0059317ce51c1f"
Original-recipient: rfc822;to@address.com

--=_e107860f353617028a0059317ce51c1f
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
 charset=ISO-8859-1

This is the text portion.
--=_e107860f353617028a0059317ce51c1f
Content-Type: multipart/related;
 boundary="=_52fd7475fcf0abd310b6a38cd33f5c46"

--=_52fd7475fcf0abd310b6a38cd33f5c46
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
 charset=ISO-8859-1

<html><body><p><img src='cid:3c0db5d0a50b8752771f64048f527338' />This is th=
e HTML portion.</p></body></html>

--=_52fd7475fcf0abd310b6a38cd33f5c46
Content-Transfer-Encoding: base64
Content-ID: <3c0db5d0a50b8752771f64048f527338>
Content-Type: image/png;
 name=background.png
Content-Disposition: inline;
 filename=background.png

iVBORw0KGgoAAAANSUhEUgAAAAEAABOICAYAAABwnAfKAAAAkUlEQVR42u3WSwrAIAwFwND7X9d1
eoHSb9TSzmYQSV5AXCRaa7lEROySJ+8uFd+8q2l73FEdkJNSRgR07q0uuVncJWBY6I9OWy85bKRB
7xo04TN8/vTO0OriziWFvcMCJqTMCui8rj5fuyMz43i1BwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAIB/swItzir5J/ImiQAAAABJRU5ErkJggg==
--=_52fd7475fcf0abd310b6a38cd33f5c46--

--=_e107860f353617028a0059317ce51c1f--

I’m at a loss on how to possibly fix this. Any body run into a similar issue or have any suggestions?

  • 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-22T16:36:19+00:00Added an answer on May 22, 2026 at 4:36 pm

    it’s your mail reader. it hides text mail if HTML mail is enabled. in gmail you can view details or you can check it in a text email only reader

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.