Viewed   79 times

iam sending html message contains table

when i recive message on gmail,hotmail,yahoo account it works fine but when receiving on other client ie Microsoft outlook it resolve it as html code !!

here is my email headers

            'MIME-Version: 1.0' . "rn" .
    'Content-Type: text/html;charset= UTF-8' . "rn" .
            'From: me <[email protected]>'



I Always use this function ,and it helps

  function sendHTMLemail($HTML,$from,$to,$subject,$fromname)
            $headers = "From: ".$fromname." <".$from.">rn";
            $headers.= "Reply-To: ".$fromname." <".$from.">rn";
            $headers .= "MIME-Version: 1.0rn"; 

            $boundary = uniqid("HTMLEMAIL"); 

        // First we be nice and send a non-html version of our email        
            $headers .= "Content-Type: multipart/alternative;".
                        "boundary = $boundaryrnrn"; 
            $headers .= "This is a MIME encoded message.rnrn"; 
            $headers .= "--$boundaryrn".
                        "Content-Type: text/plain; charset=ISO-8859-1rn".
                        "Content-Transfer-Encoding: base64rnrn";                    
            $headers .= chunk_split(base64_encode(strip_tags($HTML))); 
            // Now we attach the HTML version
            $headers .= "--$boundaryrn".
                        "Content-Type: text/html; charset=ISO-8859-1rn".
                        "Content-Transfer-Encoding: base64rnrn";                    
            $headers .= chunk_split(base64_encode($HTML)); 
            // And then send the email ....

Saturday, December 10, 2022

As a rule of thumb, email clients are configured to display attached images by default (e.g. those with a cid: URI scheme) and not load remote images (which can include tracking information).

If you attach all the images, then you'll usually get them showing up (while inflating your SMTP bandwidth use along with that of your recipients (which can make you unpopular)).

Thursday, October 20, 2022

I wonder why you're not using the form! If all you wanted is a button, you can use button and you would not need to add a whole form without any form elements.

You may want to capture the data you're sending to the server so that you can send that data. Just some few corrections:

JS - if you're using a modern version of jQuery:

$(function() {
     $(document).on('click', '#nav_waitlist_button', function() {
          return false;

PHP - do not leave out the semi-colon:

if ($_REQUEST['functionName'] == 'test') {
     mail('[email protected]', 'Some subject', 'somebody');
Monday, October 3, 2022

Use PHPMailer instead.

It allows you to send SMTP and normal emails (PHP's mail() function or expliciting all the SMTP params), and most important it lets you sepecify HTML message, plain text alternative message (but don't specify it otherwise some clients won't display the HTML one, such as bloody Lotus Notes).

It allows you to specify headers, mime, etc...

Sunday, October 30, 2022

You need to send full headers with content type, not just mail_from. Heres an example

$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "rn";
$headers .= $mail_From . "rn";

In your code:

$mail_From = $From_email; $mail_To = $payer_email; $mail_Subject = $Subject_line; $mail_Body = $email_msg;

mail($mail_To, $mail_Subject, $mail_Body, $mail_From);

The $mail_From is the fourth parameter (headers). Create a new string that contains full headers for html email plus: $_From

$mail_From = $From_email;
$mail_To = $payer_email;
$mail_Subject = $Subject_line;
$mail_Body = $email_msg;
//start $headers
$headers = "MIME-Version: 1.0" . "rn"; 
$headers .= "Content-type:text/html;charset=iso-8859-1" . "rn"; //adds content type to headers
$headers .= $mail_From . "rn"; //adds the sender details
mail($mail_To,$mail_Subject,$mail_Body,$headers); //sends the email

If you echo $headers it will be something like this

From:[email protected]
Friday, December 16, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :