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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:14:43+00:00 2026-06-14T04:14:43+00:00

i am using following code in order to send html emails through php, please

  • 0

i am using following code in order to send html emails through php, please check my below code where i am doing wrong. its send emails but not in html format, i have tried so many examples avaiable on net but unable to get emails in html formats. please help me in this regard.

 require_once "Mail.php";
 $name="Me";
 $mail_from="info@domain.com";
 $subject=$mail_from." Emails";

 $message = " 
 <html> 
  <body bgcolor=#DDDDDD> 
   YOUR HTML EMAIL
  </body> 
 </html> 
 "; 


 $From="from: $name <$mail_from>"; 

  $headers  = "From: $From\r\n"; 
  $headers  = 'MIME-Version: 1.0' . "\r\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


  $to = "Shop <info@domain.com>";

  $from = "Contact $name <info@domain.co.uk>";

  $host = "mail.exclusivehosting.net";
  $username = "info@domain.co.uk";
  $password = "(hello)";

  $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, $message);


  if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
  } else {
  //echo("<p>Message successfully sent!</p>");
  echo'<table width="800" border="0" align="center" >
  <td>';
  echo "We've recived your contact information, we will get back soon!";
echo'</td>
</table>';
  }

as out i am getting following email

  <html> 
  <body bgcolor=#DDDDDD> 
  YOUR HTML EMAIL
  </body> 
  </html> 
  • 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-06-14T04:14:45+00:00Added an answer on June 14, 2026 at 4:14 am

    You’re rewriting your headers at the bottom of the script from what I can see.

    Add the content type headers into the array.

    $headers = array (
        'From' => $from,
        'To' => $to,
        'Subject' => $subject,
        'Content-Type' => 'text/html; charset=iso-8859-1',
        'MIME-Version' => '1.0',
    

    );

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

Sidebar

Related Questions

Dear Folk's i'm using the following code in order to send the bytes of
Using the following code: db_update('nodesequence_nodes') ->fields(array( 'order' => 1, )) ->condition('nid', 1, '=') ->condition('nsid',
I was using the following Code in order to export a dataset to xlsx.
I am using the following code snippet in order to crop a image? function
I'm using the following code in order to antialias only the edges of my
I am doing the following code in order to listen for incoming SMS's and
I am using the following code in order to add images to an existing
I am using the following code to get my unique order types: NSArray *orderTypes
I wrote the below code in order to check for three files and whichever
i am using following code, to send a mail, with two attachments, Problems i'm

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.