SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to force a line break in text email

    I am using PHP's mail function to send a simple text email. However, I don't seem to be able to insert a new line. I tried this but it doesn't seem to work.

    Code PHP:
    $message = "Please check this. \n http://www.example.com";

    Any hints?

  2. #2
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I've always used \r\n
    TAKE A WALK OUTSIDE YOUR MIND.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Hyperbolik View Post
    I've always used \r\n
    Is it consistent across different systems (windows, Linux, Mac) ?

  4. #4
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Using \r\n is just a way of coding so that if you move form a Linux box to a Windows box the code will work the same. Windows pays attention to the \r and Linux pays attention to the \n, or a \r without an \n.
    TAKE A WALK OUTSIDE YOUR MIND.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •