SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict skyhigh007's Avatar
    Join Date
    Jun 2006
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    email text doesn't wrap around

    Hi

    Why is it that if the user types a very long message in the contact form and send it to my mail box. All i see is a one straight line across and then it cuts off, shouldn't it wrap around in the mail ? I'm using PHP mail

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    It's a kludgy hack, but it works for me. And I'm the only one seeing it anyway.
    PHP Code:
        if ((strlen($message))>(50))
        {
            
    $line1Message substr($message050);
            
    $line2Message substr($message5050);
            
    $line3Message substr($message10050);
            
    $line4Message substr($message15050);
            
    $line5Message substr($message20050);
            
    $line6Message substr($message25050);
            
    $message "\r\nMESSAGE: " $line1Message "\r\n" 
                
    $line2Message "\r\n" 
                
    $line3Message "\r\n" 
                
    $line4Message "\r\n" 
                
    $line5Message "\r\n" 
                
    $line6Message;
        } 
    I wrote that years ago, so if there's a better way I'm interested in knowing about it too.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    PHP Code:
    $message wordwrap($message50); 
    does the same thing but doesn't break it in the middle of words.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Addict skyhigh007's Avatar
    Join Date
    Jun 2006
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot!

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    Yes, definately a much better way. I'm embarrassed that I didn't think of it.
    Time to edit my file!

  6. #6
    SitePoint Addict skyhigh007's Avatar
    Join Date
    Jun 2006
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you


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
  •