0

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...

<?php
$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 = "
<html> 
  <body> 
     <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>
  </body> 
</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);  
?>
3
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by Zagga
0

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

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

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

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';

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

0

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

0

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.