2 Replies - 889 Views - Last Post: 22 August 2010 - 04:13 AM Rate Topic: -----

#1 CodeVillain  Icon User is offline

  • D.I.C Head

Reputation: 11
  • View blog
  • Posts: 143
  • Joined: 10-July 10

PHP Email, line breaks

Posted 21 August 2010 - 01:08 PM

Well, this should be simple but I'm having an abnormally hard time figuring out how to do it.

How do I format a PHP email? Whenever I send one it always shows up as a single paragraph with no line breaks or anything. If I try implementing HTML then all it does is send me the HTML in the email (I'm using gmail and allow use of HTML)

Can anyone help me out here?

This post has been edited by CodeVillain: 21 August 2010 - 01:09 PM

Is This A Good Question/Topic? 0
  • +

Replies To: PHP Email, line breaks

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4190
  • View blog
  • Posts: 11,864
  • Joined: 18-April 07

Re: PHP Email, line breaks

Posted 21 August 2010 - 01:58 PM

Be sure to specify the headers for the email to include "Content-Type: text/html;". If you take a close look at the mail() function you will notice it has the ability to pass in headers as a parameter. So construct the headers where you specify the content type as having text/html (and a charset would be advisable too) and it should then append the headers to the outgoing email letting any mail client know it is html format.

:)
Was This Post Helpful? 2
  • +
  • -

#3 Hary  Icon User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 427
  • Joined: 23-September 08

Re: PHP Email, line breaks

Posted 22 August 2010 - 04:13 AM

For all e-mail related stuff in php, use the PHPMailer library (http://sourceforge.net/projects/phpmailer/). It handles a lot of stuff you do not want to think about.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1