labeno Posted June 3, 2011 Share Posted June 3, 2011 Hi, I'm trying to send HTML emails using PHP. As long as the HTML email is very small, it works fine. Once the HTML is slightly larger, then it still sends an email, but when the recipient views the email, it's empty. Here's a great example that shows the exact problem. This PHP script sends two emails, the first is small, and the second is a bit larger, but just extra duplication from the small email to prove there's nothing wrong inside of the html. Any help is appreciated. Michael Here's the PHP script (don't forget to insert your email address so you can see the results): <?PHP $table_row = "<tr><td style=\"color:#ffffff; background-color:#000033; text-align:center\"><b>Column1</b></td><td style=\"color:#ffffff; background-color:#000033; text-align:center\"><b>Column2</b></td><td style=\"color:#ffffff; background-color:#000033; text-align:center\"><b>Column3</b></td><td style=\"color:#ffffff; background-color:#000033; text-align:center\"><b>Column4</b></td></tr>"; $large_email_body = "<html><body><table border=\"1\" bgcolor=\"#ccccee\" cellpadding=\"3\" cellspacing=\"0\">"; $large_email_body .= $table_row; $large_email_body .= $table_row; $large_email_body .= $table_row; $large_email_body .= "</table></body></html>"; $small_email_body = "<html><body><table border=\"1\" bgcolor=\"#ccccee\" cellpadding=\"3\" cellspacing=\"0\">"; $small_email_body .= $table_row; $small_email_body .= $table_row; $small_email_body .= "</table></body></html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: "GolfCard Team" <[email protected]>' . "\r\n"; $recipient = "<your_email_address_here>"; $small_subject = "small html email"; $large_subject = "large html email"; // send small email if (!mail($recipient, $small_subject, $small_email_body, $headers)) { exit("ERROR:Failed to send small email."); } // send small email if (!mail($recipient, $large_subject, $large_email_body, $headers)) { exit("ERROR:Failed to send large email."); } exit("SUCCESS"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/238312-cant-properly-send-html-emails-that-are-more-than-about-1000-chars/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.