Sending email fails based on what the content is

Avatar
  • Answered
Hi, When I change the content of the email, it is not sent from my site. $message .= $adv . "
"; $message .="Please Click here to publish this advertisement"; vs $message .="Please Click here to publish this advertisement"; $message .= $adv . "
"; This is the php for mail that is failing to be sent: ?php include 'includes/app_top.php'; include('includes/adv_class.php'); /* REGISTRATION STEP 1 */ //check the mail exists or not $head = FALSE; if ($head == TRUE) { $to = "[email protected]"; $subject = "Your confirmation link here"; $message = "Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $from = ADMIN_EMAIL; $headers = "From:" . $from; $sentmail = mail($to, $subject, $message, $headers); echo "Without HTML"; } else { $data = 'ok restaurant'; $adv = 'advertisement'; $headers = "MIME-Version: 1.0\n"; $headers .="Content-type: text/html; charset=UTF-8\n"; $headers .="From:Social My Town<" . ADMIN_EMAIL . ">\n"; $to = "[email protected]"; $subject = "Your confirmation link here"; $message = "Your Comfirmation link \r\n"; $message .="Click on this link to activate your account \r\n"; $message .="Dear Member,
"; $message .="You have just posted a new advertisement on" . SITE_NAMEONLY; $message .="The title for the advertisement is
"; $message .="" . $data . "
"; $message .= $adv . "
"; $message .="Please Click here to publish this advertisement"; $from = ADMIN_EMAIL; $sentmail = mail($to, $subject, $message, $headers); // p($message); echo "In this mail not send"; } // if your email succesfully sent ?> This is the mail that is sent: \n"; $to = "[email protected]"; $subject = "Your confirmation link here"; $message = "Your Comfirmation link \r\n"; $message .="Click on this link to activate your account \r\n"; $message .="Dear Member,
"; $message .="You have just posted a new advertisement on" . SITE_NAMEONLY; $message .="The title for the advertisement is
"; $message .="" . $data . "
"; $message .="Please Click here to publish this advertisement"; $message .= $adv . "
"; $from = ADMIN_EMAIL; $sentmail = mail($to, $subject, $message, $headers); // p($message); echo "Mail send"; } // if your email succesfully sent ?> Thx.
Avatar
anonymous
Hello, Thank you for your question regarding PHP Mail. Are there any PHP errors when you attempt to send the email or does it just simply not send? Try taking out this section completely and replace it with a test message, just to make sure that line is not interfering with the sending. $message .="Please Click here to publish this advertisement"; Best Regards, TJ Edens