Reputation: 168
Let's imagine this simple, I have a div (myDiv) inside a form which includes this content:
<div id=myDiv>Hi Same, please click <a href="http://www.test.com">Click here</a></div>
Now I need a php script that will send this div to someones email exactly keeping the proper html format like this:
Hi Same, Please click Click here
The problem is when I have this content in a textbox it sends it all as text. I need to send the div content.
Upvotes: 0
Views: 1355
Reputation: 12815
As you are using free service of formtoemail.com, you should have file you downloaded from their website. Find this line there:
mail($my_email,$subject,$message,$headers);
and add right before it
$headers .= PHP_EOL;
$headers .= "Content-type: text/html;";
so finaly you will have:
$headers .= PHP_EOL;
$headers .= "Content-type: text/html;";
mail($my_email,$subject,$message,$headers);
Upvotes: 1
Reputation: 102343
You need to send the email with a content-type=text/html
header.
This tells the email client to render the email as HTML.
Exactly how you do that depends on if you are using the built in php functions or a library such as swiftmailer or phpmailer.
Upvotes: 1