code_junkie

How do I get these strange characters when I try to “echo” the html string?

Nov 12th, 2011
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <����}im�
  2.  
  3. $subject = 'Invoice';
  4. $random_hash = md5(date('r', time()));
  5. $headers .= "rnContent-Type: multipart/mixed; boundary="PHP-mixed-".$random_hash.""";
  6. $body=rtrim(chunk_split(base64_encode($body)));
  7. //define the body of the message.
  8. ob_start(); //Turn on output buffering
  9. ?>
  10. --PHP-mixed-<?php echo $random_hash; ?>
  11. Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"
  12.  
  13. --PHP-alt-<?php echo $random_hash; ?>
  14. Content-Type: text/plain; charset="UTF-8"
  15. Content-Transfer-Encoding: 7bit
  16.  
  17. Hello World!!!
  18. This is simple text email message.
  19.  
  20. --PHP-alt-<?php echo $random_hash; ?>
  21. Content-Type: text/html; charset="UTF-8"
  22. Content-Transfer-Encoding: 7bit
  23.  
  24. Text Emailu.
  25.  
  26. --PHP-alt-<?php echo $random_hash; ?>--
  27.  
  28. --PHP-mixed-<?php echo $random_hash; ?>
  29. Content-Type: text/html; charset="UTF-8"; name="faktura.html"
  30. Content-Transfer-Encoding: base64
  31. Content-Disposition: attachment
  32.  
  33. <?php echo htmlentities($body); ?>
  34. --PHP-mixed-<?php echo $random_hash; ?>--
  35.  
  36. <?php
  37. //copy current buffer contents into $message variable and delete current output buffer
  38. $message = ob_get_clean();
  39. //send the email
  40. $mail_sent = @mail( $to, $subject, $message, $headers );
Add Comment
Please, Sign In to add comment