I’m a newbie to PHP and am having some difficulty doing something that seems like it should be trivial.
Thank you to anyone who can provide some advice.
I’m trying to send HTML emails using PHP’s mail API. 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 show 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 is nothing wrong inside of the html.
Any help is greatly appreciated.
Michael
Here’s the PHP script (don’t forget to insert your email address so you can see the results):
[php]<?PHP
$table_row = “
$large_email_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 .= “”;
$small_email_body = “<table border=“1” bgcolor=”#ccccee" cellpadding=“3” cellspacing=“0”>";
$small_email_body .= $table_row;
$small_email_body .= $table_row;
$small_email_body .= “”;
$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”);
?>[/php]
