html - How to send an email using php with a file as a source -
this has been answered here, result of email plain text version of html.
i have file called email.html.
this code i've used:
<?php if (!isset($_post["submit"])) { ?> <form> <input class="button" type="submit" name="submit" value="submit"> </form> <?php } else { if (isset($_post["from"])) { $email_text = file_get_contents('template.html'); $headers = "from:my.email@domain.com"; mail('another@email.com', 'hi', $email_text, $headers); } } ?>
you need add text/html content-type header email.
$headers = "from: my.email@domain.com"; $headers.= "\ncontent-type: text/html";
Comments
Post a Comment