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 4 of 4

Thread: Random Characters send with PHP mail()

  1. #1

    Random Characters send with PHP mail()

    Hi guys, I'm having a slight problem with sending emails. The email sends with the message etc as it should be, but it adds this at the bottom of the email content:

    zZvazz jb azg֭z^jǜ{ZrܨbKnǧw*.隊[-kyj)6jrri֭u

    The code is as follows:

    PHP Code:
    $to "".$email."";
        
    $re "Password Request";
        
    $msg ' **MESSAGE**';

    $headers 'From: Mentor Update - University of ****** <******@hud.ac.uk>' ."\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $boundary uniqid("HTMLDEMO");
    $headers .= "Content-Type: multipart/alternative" 
       
    "; boundary = $boundary\r\n\r\n";
    $headers .= "This is a MIME encoded message.\r\n\r\n";
    $headers .= "--$boundary\r\n" 
       
    "Content-Type: text/html; charset=ISO-8859-1\r\n" 
       
    "Content-Transfer-Encoding: base64\r\n\r\n";
    $headers .= chunk_split(base64_encode("".$msg.""));

    mail$to$re$msg$headers ); 
    Hope you will appreciate censoring the content and e-mail address

    Help with this will be appreciated! Thanks.

  2. #2
    I've fixed the problem, with the line of code that executes the mail() function, I replaced $msg with "" (with comparing it to another email sender that worked). So here it is as follows:

    PHP Code:
    mail$to$re$msg$headers ); 
    Replaced with:

    PHP Code:
    mail$to$re""$headers ); 
    However, I'm pretty new to the mail() function, so I'd like to know why this happens if anybody is willing to help? Cheers!

  3. #3
    Well I for one have never seen that before but also... if you take your $msg and leave it blank
    Code:
    ""
    that means you can't have actual body copy at all... so sorta defeats the purpose of the $msg variable. Also, try getting rid of the base64 header content declaration that may fix that gibberish
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  4. #4
    Yeah you've got really weird headers, I assume that's the issue.

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