Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 6 of 6

Thread: [php] New line

  1. #1

    [php] New line

    PHP Code:
    $email_message "Name: $name\n" .
    "Email: $email \n" .
    "Title: $title \n" .
    "Comment: $comment \n"
    My e-mail:
    Name: Ryan LastEmail: fake@yahoo.com Title: My Title Comment: This are my comments
    Verdict: New line \n not working

  2. #2

  3. #3


    if (!defined('PHP_EOL'))define(PHP_EOL,"\n");
    $email_message = '.Name: '.$name.PHP_EOL;
    // ETC

  4. #4
    So what's r and n stand for?

  5. #5
    That didn't work. Perhaps my code does not allow line returns?
    PHP Code:
    // send the message
    $att         $_FILES['design'];
    $att_path     $_FILES['design']['tmp_name'];
    $att_name     $_FILES['design']['name'];
    $att_size     $_FILES['design']['size'];
    $att_type    $_FILES['design']['type'];

    $fileatt "$att_path";                     // Path to the file                 
    $fileatt_type "application/octet-stream"// File Type 
    $fileatt_name "$att_name";                 // Filename that will be used for the file as the attachment 

    $email_from "$name";                         // Who the email is from 
    $email_subject "Levichi: Submission";     // The Subject of the email 

    $email_message "Name: $name \r\n" .            // Message that the email has in it
    "Email: $email \r\n" .
    "Title: $title \r\n" .
    "Comment: $comment \r\n";                     

    $email_to "$CONTACT";                     // Who the email is too 

    $headers "From: ".$email_from;                

    $semi_rand md5(time()); 
    $mime_boundary "==Multipart_Boundary_x{$semi_rand}x"
    $headers .= "\nMIME-Version: 1.0\n" 
    "Content-Type: multipart/mixed;\n" 
    " boundary=\"{$mime_boundary}\""

    $email_message .= "This is a multi-part message in MIME format.\n\n" 
    "Content-Type:text/html; charset=\"iso-8859-1\"\n" 
    "Content-Transfer-Encoding: 7bit\n\n" 
    $email_message "\n\n";

    // prepare file
    $file fopen($fileatt,'rb'); 
    $data fread($file,filesize($fileatt)); 

    $data chunk_split(base64_encode($data)); 

    $email_message .= "--{$mime_boundary}\n" 
    "Content-Type: {$fileatt_type};\n" 
    " name=\"{$fileatt_name}\"\n" 
    //"Content-Disposition: attachment;\n" . 
                      //" filename=\"{$fileatt_name}\"\n" . 
    "Content-Transfer-Encoding: base64\n\n" 
    $data "\n\n" 

    $ok = @mail($email_to$email_subject$email_message$headers); 

    "<center><p>Submission Sent.</p></center>");
    "<center><p>Submission Failed. Try Again.</p></center>"); 

  6. #6
    \n or \r\n probably doesn't work with your mime type text/html use <br>?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012