Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    846
    Thanks
    15
    Thanked 10 Times in 10 Posts

    Message getting cut off....

    I have the function
    PHP Code:
    function sendHTMLemail($HTML,$from,$to,$subject) {
            
        
        
    // First we have to build our email headers
        // Set out "from" address
            
    $headers "From: noreply@example.net\r\n"
        
            
    $boundary md5(time()); 
            
            
            
    // First we be nice and send a non-html version of our email
            
    $headers .= "Content-Type: multipart/alternative;".
                        
    "boundary = $boundary\r\n"
        
            
    $headers .= "This is a MIME encoded message.\r\n"

            
    //Text Version
            
    $headers .= "\n--$boundary\n".
                        
    "Content-Type: text/plain; charset=ISO-8859-1\r\n".
                        
    "Content-Transfer-Encoding: base64\r\n"
                        
            
    $headers .= chunk_split(base64_encode(strip_tags($HTML))); 
        
        
    // Now we attach the HTML version
            
    $headers .= "\n--$boundary\n".
                        
    "Content-Type: text/html; charset=ISO-8859-1\r\n".
                        
    "Content-Transfer-Encoding: base64\r\n"
                        
            
    $headers .= chunk_split(base64_encode($HTML)); 
        
        
    // And then send the email ....
            
    $doit1 mail($to,$subject,"",$headers);
            echo 
    $doit1 "<strong>Mail sent1</strong>" "Mail failed1";
            return 
    $doit;
        } 
    which now due to my host, works. To a point. The message I pass into the function to be send starts out:
    PHP Code:
    $message "<span style='font-family: Verdana, Geneva, sans-serif; font-size: 12px;'>Adrenaline Junkies Online Store<br />
    ----------------------------------------<br />
    Hello "
    .$_POST["full_name"].",<br />

    Either you or someone pretending to be you registered an account at our online store at http://store.example.net.  If this
    was you we ask that you please confirm the request by visiting the activation link below.  Just click on the link or copy and paste it
    into your browser.
    <p />"
    ;
    //Actually longer I just cut it out for this posts sake. :) 
    However in the E-mail I get something like:
    Code:
    enaline Junkies Online Store
    ----------------------------------------
    Hello Dawson Willie,
    Either you or someone pretending to be you registered an account at our online store at http://store.example.net. If this was you we ask that you please confirm the request by visiting the activation link below. Just click on the link or copy and paste it into your browser.
    Can anyone else see why my message is being cut off at the beginning?
    Last edited by dniwebdesign; 11-12-2010 at 07:39 PM.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #2
    New Coder
    Join Date
    Apr 2010
    Posts
    45
    Thanks
    0
    Thanked 8 Times in 8 Posts
    You're currently using a mixture of \n and \r\n. I wonder what happens if you make all of these \r\n?

    Might not make a difference but I've known new line characters to break multipart emails before.
    BIOSTALL.com - Web Development Snippets, Hints and Tips

  • #3
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    846
    Thanks
    15
    Thanked 10 Times in 10 Posts
    Yea, it was the \r\n. Not enough in some places, too many in others. :\ Thanks.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com


  •  

    Posting Permissions

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