Advertisement
rogerin

Untitled

May 3rd, 2011
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?
  2. $mailheaders = "From: $fromn";
  3. $mailheaders .= "Reply-To: $fromn";
  4. $mailheaders .= "Cc: $ccn";
  5. $mailheaders .= "Bcc: $bccn";
  6. $mailheaders .= "X-Mailer: Script para enviar arquivo atachadon";
  7.  
  8. $msg_body = stripslashes($body);
  9.  
  10. if ($attach != "none")
  11. {
  12. $file = fopen($attach, "r");
  13. $contents = fread($file, $attach_size);
  14. $encoded_attach = chunk_split(base64_encode($contents));
  15. fclose($file);
  16.  
  17. $mailheaders .= "MIME-version: 1.0n";
  18. $mailheaders .= "Content-type: multipart/mixed; ";
  19. $mailheaders .= "boundary="Message-Boundary"n";
  20. $mailheaders .= "Content-transfer-encoding: 7BITn";
  21. $mailheaders .= "X-attachments: $attach_name";
  22.  
  23. $body_top = "--Message-Boundaryn";
  24. $body_top .= "Content-type: text/plain; charset=US-ASCIIn";
  25. $body_top .= "Content-transfer-encoding: 7BITn";
  26. $body_top .= "Content-description: Mail message bodynn";
  27.  
  28. $msg_body = $body_top . $msg_body;
  29.  
  30. $msg_body .= "nn--Message-Boundaryn";
  31. $msg_body .= "Content-type: $attach_type; name="$attach_name"n";
  32. $msg_body .= "Content-Transfer-Encoding: BASE64n";
  33. $msg_body .= "Content-disposition: attachment; filename="$attach_name"nn";
  34. $msg_body .= "$encoded_attachn";
  35. $msg_body .= "--Message-Boundary--n";
  36. }
  37.  
  38. mail($to, stripslashes($subject), $msg_body, $mailheaders);
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement