The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 6 of 6

Thread: [php] New line

  1. #1

    [php] New line

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

  2. #2

  3. #3
    \r\n

    or

    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" 
                    
    "--{$mime_boundary}\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)); 
    fclose($file); 

    $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" 
                      
    "--{$mime_boundary}\n"
    unset(
    $data);
    unset(
    $file);
    unset(
    $fileatt);
    unset(
    $fileatt_type);
    unset(
    $fileatt_name); 

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

    if(
    $ok)
        echo(
    "<center><p>Submission Sent.</p></center>");
    else
        echo(
    "<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

 Credits

Copyright 1999 - 2012