1

I have two problems.

1) Upon of receival of the email, it does not capture the html within the body

2) It only issues the email to the recepient [email protected] and not [email protected]

Everything else works fine.

$to = '[email protected], [email protected]';
        $subject = "New interested recruiter: " .$cleanEmail. "";
        $header = "From: [email protected]";
        $header .= "Reply-To: [email protected]";
        $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
                $message = "<html>";
                $message .= "<body>";
        $message = "New interested recruiter: ".$cleanEmail."<br><br>";
                $message .= $cleanMessage;
                $message .= "</body>";
                $message .= "</html>";

        mail($to, $subject, $message, $header) or die ("Failure");

Thanks in advance

3
  • KerPlunk... $message = "New interested recruiter: ".$cleanEmail."<br><br>"; Commented Sep 25, 2015 at 13:08
  • 1
    RTM too php.net/manual/en/function.mail.php it's all in there. Commented Sep 25, 2015 at 13:10
  • I'm not sure you can define 2 values in $to. Instead try using the To header. Commented Sep 25, 2015 at 13:10

2 Answers 2

1

There are a few things wrong here.

The manual for the mail() function states:

// multiple recipients
$to  = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';

therefore, do as the manual states.

as well as using a MIME: (also from the manual)...

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

Then the missing concatenate is breaking your message variable

$message  = "New interested recruiter: ".$cleanEmail."<br><br>";
         ^ missing dot
Sign up to request clarification or add additional context in comments.

Comments

0

Try to add header like this ..

$header = "From: [email protected]\r\n";
$header .= "Reply-To: [email protected]\r\n";
$header  .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset: utf8\r\n";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.