SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New lines in a simple email??

    Hi all,

    I am trying to create new line for a simple email like
    Code:
    $body = "Welcome,\r\n" ;
    $body .= "testing new line".chr(13).chr(10);
    $body .= "2nd or 3rd line";
     
    with
     
    <a href="mailto:?subject=new lines&body=<?php echo $body;?>">
    But the chr(13).chr(10) don't work.

    Any suggestions?

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Does it make any difference if you encode the string before appending it to the URI?

    Code:
    <a href="mailto:?subject=new lines&body=<?php echo urlencode($body); ?>">
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i would just simply write the new line characters, or store them in a variable thus:
    PHP Code:
    $newline "\r\n";

    $body "this is the mail body".$newline
    then do your hyperlink

  4. #4
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @lilleman, your suggestions almost works now I get new lines, but als +++

    @djdykes, already tried that but "\r\n" doesn't work.

  5. #5
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    haha that's right up your street then i take it???

    sorry i couldn't help.

    Jim


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
  •