-2

Possible Duplicate:
Sending HTML email from PHP

I need to send an html mail using the php mailto() function. I have the mail.html(which is the body of the mail i need to send) in the same folder where I have kept the mailing script. I want the content of the html content in the body of the mail and not as an attachment. How can I do it? Thanks in advance.

Community
  • 1
  • 1
Harikrishnan
  • 7,765
  • 13
  • 62
  • 113
  • 1
    You could start with the manual: http://php.net/manual/en/function.mail.php – jeroen Jun 13 '12 at 17:13
  • Show is the code you're using to do this and explain what it does instead of working. Don't forget to include a non-HTML version of the email as well. Many spam filters will score mail higher as spam if it contains a text/plain part that doesn't match the text/html part, or if it doesn't contain a text/plain part at all. – ghoti Jun 13 '12 at 17:13

1 Answers1

0

Just be sure to add a HTML header to your mail:

<?php
$header = "Content-Type: text/html\n";   
mail($to, $subject, $text, $header);
?>
libjup
  • 4,019
  • 2
  • 18
  • 23
  • Now you can put HTML-code into your $text var: $text = "I'm a bold text"; – libjup Jun 13 '12 at 17:15
  • Well, actually i have a file already. so i need to copy pate the content of that file to here? – Harikrishnan Jun 13 '12 at 17:18
  • check out http://php.net/manual/de/function.fopen.php and http://php.net/manual/de/function.fread.php if you have a concrete question, feel free to ask – libjup Jun 13 '12 at 17:20
  • Well, i tried it, but i had some images to be embedded into the body. it is not going. How can i do that? – Harikrishnan Jun 13 '12 at 17:37