Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][HTML] Wysłanie wiadomości z grafiką
crrs11
post 13.05.2020, 14:31:47
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


Cześć,

w internecie znalazłem dużo różnych sposobów do wstawiania grafiki do wiadomości ale nie radzę sobie z tym. Plik JPG znajduje się w tym samym katalogu na serwerze co plik PHP. Jak wstawić grafikę żeby była wysłana w wiadomości na dole jako stopka. Poniżej mój plik PHP


  1. <?php
  2.  
  3. echo "<body style='background-color:pink'>";
  4. if ((empty($_POST['nazwa'])) || (empty($_POST['ulica'])) || (empty($_POST['miasto'])) || (empty($_POST['mail'])) || (empty($_POST['ilosc'])))
  5. {
  6. echo "ORDER WAS NOT SENT !!! >>> Not all required details have been filled in: Name, Street, City, Mail, Quantity.";
  7. echo " <<< Return to previous page, complete and ORDER again";
  8. }
  9. if ($_POST['ilosc']<100)
  10. {
  11. echo "ORDER WAS NOT SENT !!! >>> Quantity too small (minimum 100 pieces) !!! ";
  12. echo "<<< Return to previous page, correct and ORDER again";
  13. }
  14.  
  15.  
  16. $naglowek = 'From: Face Masks PAWO <xxx@xxx.pl>' . "\r\n" .
  17. 'Reply-To: xxx@xxx.pl' . "\r\n" .
  18. 'X-Mailer: PHP/' . phpversion();
  19. $naglowek .= "MIME-Version: 1.0\r\n";
  20. $naglowek .= "Content-Type: text/html; charset=utf-8\r\n";
  21.  
  22. $temat = "Order / Zamowienie ".$_POST['nazwa'];
  23.  
  24.  
  25. $wiadomosc = "<html>
  26. <body style='background-color:pink'>
  27. <head>
  28. </head>
  29. <body>
  30. <br>
  31. ---------------------------------------<br>
  32. RECIPIENT / ODBIORCA :<br>
  33. ---------------------------------------<br>
  34. <br>
  35. <table>
  36. <tr>
  37. <td><b>Name / Nazwa:</b></td><td> </td><td> </td><td>".$_POST['nazwa']."</td>
  38. </tr>
  39. <tr>
  40. <td><b>Street / Ulica:</b></td><td> </td><td> </td><td>".$_POST['ulica']."</td>
  41. </tr>
  42. <tr>
  43. <td><b>City / Miasto:</b></td><td> </td><td> </td><td>".$_POST['miasto']."</td>
  44. </tr>
  45. <tr>
  46. <td><b>VAT number / NIP:</b><td><td> </td><td>".$_POST['nip']."</td>
  47. </tr>
  48. </table>
  49. <br>
  50. e-mail: ".$_POST['mail']." <br>
  51. <br>
  52. ---------------------------------------<br>
  53. DETAILS / SZCZEGOLY :<br>
  54. ---------------------------------------<br>
  55. <br>
  56. Quantity / Ilosc : ".$_POST['ilosc']."<br>
  57. Price / Cena : ".$_POST['cena']."<br>
  58. <br>
  59. Transport/Shipment : ".$_POST['transport']."<br>
  60. <br>
  61.  
  62. </body>
  63. </html>";
  64.  
  65.  
  66.  
  67. if (mail ("xxx@xxx.pl,".$_POST['mail'], $temat, $wiadomosc, $naglowek ))
  68. {
  69. echo "Thank you for sending a message with the order, confirmation sent to: ".$_POST['mail'];
  70.  
  71.  
  72. } else {
  73. echo "Error sending message, try it again";
  74. };
  75.  
  76. ?>
  77. <br>
  78. <img src="xxx.jpg">
  79. <br>


Ten post edytował crrs11 13.05.2020, 14:34:26
Go to the top of the page
+Quote Post
viking
post 13.05.2020, 15:01:54
Post #2





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

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


Tak jak wszystko inne. Wstawiasz jako pełen url do zasobu.


--------------------
Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 07:04:51
Post #3





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


Tak questionmark.gif Nie działa.

  1. $url = "http://xxx.pl/images/logo2.jpg";
  2. $url


Ten post edytował crrs11 14.05.2020, 07:05:22
Go to the top of the page
+Quote Post
nospor
post 14.05.2020, 07:07:22
Post #4





Grupa: Moderatorzy
Postów: 36 455
Pomógł: 6292
Dołączył: 27.12.2004




To moze jeszcze pokaz z laski swojej jak to wstawiasz do tego IMG, niesadzisz?


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 07:21:13
Post #5





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


Możesz napisać jak to ma wyglądać ?
Go to the top of the page
+Quote Post
viking
post 14.05.2020, 07:50:50
Post #6





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

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


https://developer.mozilla.org/en-US/docs/We...TML/Element/img


--------------------
Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 07:58:59
Post #7





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


Nic mi to nie dało, zanim poprosiłem o pomoc szukałem dwa dni w internecie i dalej nie umiem tego zrobić. Pierwszy raz działam w PHP i mam tylko jeden problem którego nie mogę rozwiązać.
Naprawdę nikt nie możne mi napisać dokładnie co mam gdzie wkleić ?
Go to the top of the page
+Quote Post
viking
post 14.05.2020, 08:00:37
Post #8





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

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


To nie ma nic z php wspólnego. Są to podstawy html. W miejscu gdzie chcesz wkleić grafikę w html wstawiasz
  1. <img src="http://xxx.pl/images/logo2.jpg" alt="Logo"/>


--------------------
Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 08:04:48
Post #9





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


robiłem tak i nie działa, nawet wiadomość nie zostaje wysłana


  1. <br>
  2.  
  3. <img src=""http://xxx.pl/images/logo2.jpg"" alt="Logo"/>
  4.  
  5. </body>
  6. </html>"
Go to the top of the page
+Quote Post
viking
post 14.05.2020, 08:34:56
Post #10





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

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


Znak escape to \ a nie podwójny ""


--------------------
Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 08:58:49
Post #11





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


Po zmianie wiadomość zostaje wysłana, kod jest niewidoczny w wiadomości ale obrazka nie ma.

<img src=\ http://xxx.pl/images/logo2.jpg \ >

Ten post edytował crrs11 14.05.2020, 09:00:47
Go to the top of the page
+Quote Post
nospor
post 14.05.2020, 09:02:05
Post #12





Grupa: Moderatorzy
Postów: 36 455
Pomógł: 6292
Dołączył: 27.12.2004




<img src=\"http://xxx.pl/images/logo2.jpg\">


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 09:20:58
Post #13





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


Tak tez próbowałem, sytuacja bez zmian. Zrobiłem ze spacjami bo po kliknięciu w <img src=\"http://xxx.pl/images/logo2.jpg\"> przeglądarka otwiera link http://xxx.pl/images/logo2.jpg/

Ten post edytował crrs11 14.05.2020, 09:23:58
Go to the top of the page
+Quote Post
nospor
post 14.05.2020, 09:25:57
Post #14





Grupa: Moderatorzy
Postów: 36 455
Pomógł: 6292
Dołączył: 27.12.2004




Pokaz caly kod po zmianach


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 09:52:31
Post #15





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


wiersz 64

  1. <?php
  2.  
  3. echo "<body style='background-color:#161712'>";
  4. if ((empty($_POST['nazwa'])) || (empty($_POST['ulica'])) || (empty($_POST['miasto'])) || (empty($_POST['mail'])) || (empty($_POST['ilosc'])))
  5. {
  6. echo "ORDER WAS NOT SENT !!! >>> Not all required details have been filled in: Name, Street, City, Mail, Quantity.";
  7. echo " <<< Return to previous page, complete and ORDER again";
  8. }
  9. if ($_POST['ilosc']<100)
  10. {
  11. echo "ORDER WAS NOT SENT !!! >>> Quantity too small (minimum 100 pieces) !!! ";
  12. echo "<<< Return to previous page, correct and ORDER again";
  13. }
  14.  
  15. $naglowek = 'From: <xxx@xxx.pl>' . "\r\n" .
  16. 'Reply-To: xxx@xxx.pl' . "\r\n" .
  17. 'X-Mailer: PHP/' . phpversion();
  18. $naglowek .= "MIME-Version: 1.0\r\n";
  19. $naglowek .= "Content-Type: text/html; charset=utf-8\r\n";
  20.  
  21. $temat = "Order / Zamowienie ".$_POST['nazwa'];
  22.  
  23.  
  24. $wiadomosc = "<html>
  25. <body style='background-color:white'>
  26. <head>
  27. </head>
  28. <body>
  29. ORDER / ZAMOWIENIE<br>
  30. <br>
  31. ---------------------------------------<br>
  32. RECIPIENT / ODBIORCA :<br>
  33. ---------------------------------------<br>
  34. <br>
  35. <table>
  36. <tr>
  37. <td><b>Name / Nazwa:</b></td><td> </td><td> </td><td>".$_POST['nazwa']."</td>
  38. </tr>
  39. <tr>
  40. <td><b>Street / Ulica:</b></td><td> </td><td> </td><td>".$_POST['ulica']."</td>
  41. </tr>
  42. <tr>
  43. <td><b>City / Miasto:</b></td><td> </td><td> </td><td>".$_POST['miasto']."</td>
  44. </tr>
  45. <tr>
  46. <td><b>VAT number / NIP:</b><td><td> </td><td>".$_POST['nip']."</td>
  47. </tr>
  48. </table>
  49. <br>
  50. e-mail: ".$_POST['mail']." <br>
  51. <br>
  52. ---------------------------------------<br>
  53. DETAILS / SZCZEGOLY :<br>
  54. ---------------------------------------<br>
  55. <br>
  56. Quantity / Ilosc : ".$_POST['ilosc']."<br>
  57. Price / Cena : ".$_POST['cena']."<br>
  58. <br>
  59. Transport/Shipment : ".$_POST['transport']."<br>
  60. <br>
  61.  
  62. <img src=\http://xxx.pl/images/logo2.jpg\>
  63.  
  64. </body>
  65. </html>"
  66.  
  67. ;
  68.  
  69.  
  70.  
  71. if (mail ("xxx@xxx.pl,".$_POST['mail'], $temat, $wiadomosc, $naglowek ))
  72. {
  73. echo "Thank you for sending a message with the order, confirmation sent to: ".$_POST['mail'];
  74. echo '<span style="color: red;">' . $_POST['nip'] . '</span>';
  75.  
  76. } else {
  77. echo "Error sending message, try it again";
  78. };
  79.  
  80. ?>
  81. <br>
  82. <img src="xxx.jpg">
  83. <br>


Ten post edytował crrs11 14.05.2020, 09:53:47
Go to the top of the page
+Quote Post
nospor
post 14.05.2020, 09:56:43
Post #16





Grupa: Moderatorzy
Postów: 36 455
Pomógł: 6292
Dołączył: 27.12.2004




Toc mowilem ze ma byc
<img src=\"http://xxx.pl/images/logo2.jpg\">

Zrob te poprawke, odpal maila i pokaz kod ponownie jesli nadal nie bedzie dzialac


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
crrs11
post 14.05.2020, 13:52:37
Post #17





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.05.2020

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


Wielkie dzięki wszystkim, już dział.



Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 24.04.2024 - 03:40