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 566995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:02:10+00:00 2026-05-13T13:02:10+00:00

I’m using PEAR to send HTML emails from my website. My email are sent,

  • 0

I’m using PEAR to send HTML emails from my website.
My email are sent, but they are not formatted according to the CSS when viewed in Hotmail/Yahoo/GMail. When I view them in Windows Live MAil, they look great.

To be more specific, it seems as if non of the CSS is taken into consideration (text format, background images etc.).

Here’s the code I use to send the email:

$headers = array('From' => $from, 'Subject' => $subject, 'To' => $to);

require_once 'Mail.php';
require_once 'Mail/mime.php';

$crlf = "\n";

$mime = new Mail_mime($crlf);
$mime->setTXTBody($plainText);
$mime->setHTMLBody($htmlText);

$body = $mime->get();
$headers = $mime->headers($headers);

$mail = Mail::factory("mail");
$send = $mail->send($to, $headers, $body);
if (PEAR::isError($send)) {
    $mail_sent = 0;
}else {
    $mail_sent = 1;
}   

Should I include Content-Type in the header? I’ve tried but it didn’t help.

$htmlText is a variable containing my html. The style is embeded into the HTML (not linked to a CSS file).

If anyone can let me know why my email is not formatted in the web clients, I would be gratefull.

Thanks a lot,

Ziv

  • 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-13T13:02:11+00:00Added an answer on May 13, 2026 at 1:02 pm

    You can only use very simple style rules in mails, and it should be specified inline and not in an embedded stylesheet. You can read a lot of information here:

    http://www.anandgraves.com/html-email-guide

    • 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'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a bunch of posts stored in text files formatted in yaml/textile (from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.