0

I have a very long form and the content of the form is sent via mail (HTML email).

My PHP mail function is working perfectly for the rest of the content. But when I add the following content to the message body, the mail is not working.

<h4><span style="text-decoration:underline">OCCUPATION:</span></h4>

<p>Please provide a specific and identifiable business activity and
your current position . Vague references such as"Businessman" or
"Manager" will not be accepted and will delay the incorporation
process. In the case of no employment please describe the normal
day to day activities such as "House Wife" In case of retirement
please provide details of previous occupation and your last
position.<br />
<textarea name="personal_information_occupation">

</textarea></p>
<hr />

I went through each and every line but cannot find whats wrong with these particular lines.

My PHP mail sends HTML email.

<?php

if(mail($to, $subject, $message, $headers)){
            $mail_status_message = "<p class='success-msg'> Form Submitted Successfully. </p>";
        }else{
            $mail_status_message = "<p class='error-msg'> Something went wrong. Please try again later. </p>";
        }

?>

Basically I am getting the Something went wrong. Please try again later when I add the above code to the message body.

The mail headers are

    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    // Additional headers
    $headers .= 'To: '.$to_name.'<'.$to_email.'>' . "\r\n";
    $headers .= 'From: Business Name <email@example.com>' . "\r\n";
prakashchhetri
  • 1,806
  • 4
  • 36
  • 61

1 Answers1

0

If your mail() function call is returning FALSE and you are getting no PHP errors, then this indicates a problem with your mail server. The message is being sent to the mail server, but is not being accepted for whatever reason. Exactly what that reason is depends on the configuration of your PHP server and your mail server, so you have to check your mail server's logs to find out what's happening. See How can I get the error message for the mail() function?

Community
  • 1
  • 1
nullability
  • 10,545
  • 3
  • 45
  • 63