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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -