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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:56:06+00:00 2026-05-31T19:56:06+00:00

When I send html message through an mail sending it will break the design

  • 0

When I send html message through an mail sending it will break the design in mail account. The code is below:

<?php
$center_part2 = "";
$mail_ID = "exmaple.gmail.com";
$subject = "UnTouched Ticket Notification";
$headers = "From: example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$part = '<html><body>';
$part .= '<div style="background-color: #EEEEEE;border-bottom: 1px solid #DCDCDC;padding: 10px 10px 20px;width: 500px; float:left;font-size:12px;font-weight:bold;">';
$part1 = '<div style="width:500px;">';
$part1 .= '<div style="width:500px;background-color:#eeeeee;padding: 10px 0 20px;border-bottom:1px solid #dcdcdc;">';  
$part1 .= '<div style="width:450px;background-color:#eeeeee;padding: 10px 0 20px;border-bottom:1px solid #dcdcdc; height:auto; float:left;font-size:12px;margin-left:50px; font-weight:bold;">';
$part3 = '</div></div></div>';
$part3 .= '</body></html>';
$center_part = 'You have opened '.$inr.' tickets . But the following tickets are not updated yet ,';
$center_part2.="<div style='width:345px;color:#000000;font-size:12px;margin-left:75px; font-weight:bold; height:auto; margin-top:10px;'>"; 
    for ($k=1; $k<=70; $k++){

       $new.="<p>Ticket &#35;".$K." Last Updated  ".$K." days ".$K." hours  ago &#33;</p>";
    }
    $center_part2.=$new."</div>";
    if($mail_ID){
        $message = "";
        $center_part1 = 'Dear Admin ,'; 
        $message = $part.$center_part1.$part1.$center_part.$center_part2.$part3;
        mail($mail_ID, $subject, $message, $headers);
    }
?>

When I opened the gmail I get the mail like this:

Screenshot

So what is the problem in my code?

  • 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-31T19:56:07+00:00Added an answer on May 31, 2026 at 7:56 pm

    I’ll post my comment as an answer as davidethell suggested, in case anyone else lands here with the same problem.

    The display issue was due to the <div> tags having float:left and a fixed width, causing them to become stacked side by side where the width permitted.

    The ! problem where random ! are inserted into the email content is due to exceeding the max characters per line. Keeping each line under 512 characters will resolve this. Use a \n to break up the content as required.

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

Sidebar

Related Questions

I am trying to send an HTML mail through PHP, but I can't seem
I have written some code in my VB.NET application to send an HTML e-mail
Hi there I'm trying to send an HTML email through a PHP webform. The
I have a problem with sending emails to gmail through Php mail() function. I
I am using PEAR mail system to send authenticated mails.I need to send HTML
Is the following From header incorect? // To send HTML mail, the Content-type header
I am trying to send an HTML email using Perl. open(MAIL,|/usr/sbin/sendmail -t); ## Mail
Hi I'm using System.Net.Mail to send some HTML formatted emails. What is the correct
I am using the following code to send out a Multipart/Alternative HTML and Plain
I am trying to send some message through Websocket to the server. The web

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.