Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z załącznikiem w mailu.
patrykt
post
Post #1





Grupa: Zarejestrowani
Postów: 101
Pomógł: 0
Dołączył: 3.12.2005

Ostrzeżenie: (0%)
-----


Witam,

Wysyłanie maili na serwerze działa jednak tylko bez załączników. O co mam poprosić admina aby również z załącznikami były wysyłane?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
patrykt
post
Post #2





Grupa: Zarejestrowani
Postów: 101
Pomógł: 0
Dołączył: 3.12.2005

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $file_tmp_name = $_FILES['filename']['tmp_name'];
  3.  $file_name = $_FILES['filename']['name'];
  4.  $file_type = mime_content_type($file_name);  
  5.  
  6.  $head = "From: $from\n"; 
  7.  $head .= "Reply-To: $from\n"; 
  8.  $head .= "X-Mailer: PHP\n"; 
  9.  $head .= "X-Sender: $from\n"; 
  10.  $head .= "MIME-version: 1.0\n"; 
  11.  $head .= "Content-type: multipart/mixed; "; 
  12.  $head .= "boundary=\"$boundary\"\n"; 
  13.  $head .= "Content-transfer-encoding: 7BIT\n"; 
  14.  $head .= "X-attachments: $file_name;\n\n";  
  15.  
  16.  $mesg = "--" . $boundary . "\n";
  17.  $mesg .= "Content-type: text/html; charset=ISO-8859-2\n\n";
  18.  $mesg .= $message . "\n"; 
  19.  $mesg .= "--" . $boundary . "\n";
  20.  $mesg .= "Content-type: " . $file_type . "; name=\"$file_name\";\n";  
  21.  $mesg .= "Content-Transfer-Encoding: base64\n"; 
  22.  $mesg .= "Content-disposition: attachment; filename= \"$file_name\"\n\n"; 
  23.  $mesg .= fileopenanddecode($file_tmp_name) . "\n";  
  24.  $mesg .= "--" . $boundary . "-- \n";
  25.  
  26.  mail($v, $subject, $mesg, $head);
  27. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 05:15