Hi, I wrote a php form and when I look at the confirmation email.... 2 things happen.

  1. My logo dipslays as a link... I want it to be an image...
  2. All the html tags display with the content that is meant to show... I don't want to see the tags, I want to see the content/message...

So how do I fix these 2?

here is the code that is responsible for all of this...

$sendto = $_POST['email']; // this is the email address collected form the form 
$subject = "email confirmation"; // Subject 
$message_client = "We are confirming your inquery...";
$header = "From: myemail@gmail.com\r\n"; 
$header .= "Reply-to: myemail@gmail.com\r\n"; 

   $v2 = "
     <img src= 'logo.png' />
     <h3>Hello $first_name, your form has been submitted! We will review it and get back to you as soon as possible!</h3>
</html> ";
$message_client = $v2; 
   //end of message 
    $headers  = "From: $from\r\n"; 
    $headers .= "Content-type: text/html\r\n"; 

mail($sendto, $subject, $message_client, $header);  
4 Years
Discussion Span
Last Post by Zagga

the reason you recieved html tags is because you did not include an html header, and the reason the image is not displayed it's because your did not specify an absolute path. this is the simple example of how to send html email

// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
  <title>Birthday Reminders for August</title>
  <p>Here are the birthdays upcoming in August!</p>

// 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";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

source : http://php.net/manual/en/function.mail.php


It didn't do anything unfortunately, can you point out another solution?


Could you post the code you have now? You may be getting $header and $headers mixed up, you seem to have both set.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.