Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Wysyłanie maila z załącznikiem
ufoxxx
post
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 4.01.2015

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


Siemka
Mój problem polega na tym że nie wiem jak wyświetlić tresc formularzy na emailu jeden pod drugim w skrypcie który wysyła plik na emaila, tutaj jest przykładowo telefon i marka.
  1. <?
  2. $strTo = 'mojemail@gmail.com';
  3. $strSubject = $_POST["txtSubject"];
  4. $strMessage = nl2br($_POST["txtDescription"]);
  5. $strFrom = nl2br($_POST["txtFormName"]);
  6. $marka = $_POST["marka"];
  7. $telefon = $_POST["telefon"];
  8.  
  9. //*** Uniqid Session ***//
  10. $strSid = md5(uniqid(time()));
  11.  
  12. $strHeader = "";
  13. $strHeader .= "From: ".$_POST["txtFormName"]."<".$_POST["txtFormEmail"].">\nReply-To: ".$_POST["txtFormEmail"]."";
  14.  
  15. $strHeader .= "MIME-Version: 1.0\n";
  16. $strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
  17. $strHeader .= "This is a multi-part message in MIME format.\n";
  18.  
  19. $strHeader .= "--".$strSid."\n";
  20. $strHeader .= "Content-type: text/html; charset=utf-8\n";
  21. $strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
  22. $strHeader .= $strMessage."\n\n";
  23. $strHeader .= $strFrom."n\n\n";
  24.  
  25. //*** Attachment ***//
  26. if($_FILES["fileAttach"]["name"] != "")
  27. {
  28. $strFilesName = $_FILES["fileAttach"]["name"];
  29. $strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"])));
  30. $strHeader .= "--".$strSid."\n";
  31. $strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
  32. $strHeader .= "Content-Transfer-Encoding: base64\n";
  33. $strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
  34. $strHeader .= $strContent."\n\n";
  35. }
  36.  
  37.  
  38. $flgSend = @mail($strTo,$strSubject,null,$strHeader); // @ = No Show Error //
  39.  
  40. if($flgSend)
  41. {
  42. echo "Mail send completed.";
  43. }
  44. else
  45. {
  46. echo "Cannot send mail.";
  47. }
  48. ?>


Macie pomysły jak ten skrypcik przerobić(IMG:style_emoticons/default/questionmark.gif) jakieś wskazówki (IMG:style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
kapslokk
post
Post #2





Grupa: Zarejestrowani
Postów: 965
Pomógł: 285
Dołączył: 19.06.2015
Skąd: Warszawa

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


Trzeci parametr funkcji mail() to treść wiadomości. Możesz tam wrzucić HTML z zawartością formularzy.
Go to the top of the page
+Quote Post
ufoxxx
post
Post #3





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 4.01.2015

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


Proszę o mały przykładzik (IMG:style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post
ctom
post
Post #4





Grupa: Zarejestrowani
Postów: 321
Pomógł: 55
Dołączył: 19.04.2009

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


Cytat(ufoxxx @ 31.08.2015, 20:21:38 ) *
Proszę o mały przykładzik (IMG:style_emoticons/default/tongue.gif)


http://php.net/manual/en/function.mail.php szukaj : Examples
Go to the top of the page
+Quote Post

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: 23.08.2025 - 01:02