Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Wysyłanie maili
XxmanxX
post
Post #1





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 22.07.2009

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


Witam, czy możecie sprawdzić mi kod. Czasami w otrzymanym mailu są widoczne znaczniki albo tekst nie ma określonych kolorow lub wartość funkcji date('d-m-Y / H:i',$problem_start_date_time) zamiast znajdować się po "Problem start date / time:"
jest gdzieś na początku

  1. $to=$zmienna;
  2. $subject ="SUBJECT";
  3. $message ="<STYLE type='text/css'>th.title{color:white;background-color:red;font-size:40px} td{width:320;font-family:sans-serif;font-size:14px;font-weight:bold} td.description{color:black}</STYLE>";
  4. $message .="<table border=0 cellpadding=0 cellspacing=1 width='100%'><tr><th class='title'>HEADER</th></tr></table>";
  5. $message .="<div class='description'><p>TEXT</p><p>TEXT:</p></div>";
  6. $message .="<table border=0 cellpadding=7 cellspacing=1 width='100%'><tr><td>Message date / time:</td><td>".date('d-m-Y / H:i')."</td></tr>";
  7. $message .="<tr><td>Service:</td><td><font color=red>$result[category] -> $result[service]</font></td></tr>";
  8. $message .="<tr><td>Status:</td><td><font color=red>DETECTED AND OPEN</font></td></tr>";
  9. $message .="<tr><td>Problem description:</td><td><font color=red>".nl2br($_POST[problem_description])."</font></td></tr>";
  10. $message .="<tr><td>Main impacted applications & services:</td><td><font color=red>".nl2br($_POST[main_impacted])."</font></td></tr>";
  11. $message .="<tr><td>Problem start date / time:</td><td>".date('d-m-Y / H:i',$problem_start_date_time)."</td></tr></table>";
  12. $message .="<div class='description'><p>TEXT</p><p>TEXT</p><p>TEXT</p><p>TEXT</p>
  13. <p>
  14. -------------------------------------------------------------------------------------<br/>
  15. <b>FOOTER</b><br/>
  16. -------------------------------------------------------------------------------------<br/>
  17. <i>This is an automatic email. Please, do not reply.</i></p></div>";
  18. $headers ="MIME-Version: 1.0"."\n";
  19. $headers .="Content-type: text/html; charset=iso-8859-2"."\n";
  20. $headers .="Content-Transfer-Encoding: 8bit"."\n";
  21. $headers .="From: admin@domain.com"."\n";
  22. $mailsent = mail($to,$subject,$message,$headers);


Czy w wiadomościach moze byc CSS czy lepiej wszystko html zastąpić ?
Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
XxmanxX
post
Post #2





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 22.07.2009

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


przez POST przechodza znaki alfabetu,_(podkreslenie) i cyfry oddzielone spacjami, poki co sam sobie to testuje dlatego brak jest odpornosci na ataki, zakladam wprowadzenie poprawnych danych wejsciowych.
Dodal apostrofy $_POST['pole'] ale nie pomoglo.
Pozdrawiam

Rozwiązanie:
  1. $to=$zmiennal
  2. $subject ='text';
  3. $message ='
  4. <STYLE type=text/css>th.title{color:white;background-color:red;font-size:40px} td.property{width:320px;font-family:sans-serif;color:black;font-size:14px} td.value{color:red;text-align:left;font-family:sans-serif;font-weight:bold;font-size:14px}</STYLE>
  5. <table border=0 cellpadding=0 cellspacing=1 width=100%><tr><th class=title>HEADER</th></tr></table>
  6. <p>Hello,</p><p>PRZYKLADOWY TEXT :</p>
  7. <table border=0 cellpadding=10 cellspacing=1 width=100%>
  8. <tr><td class=property>parametr:</td><td class=value>'.date('d-m-Y / H:i').'</td></tr>
  9. <tr><td class=property>parametr:</td><td class=value>'.$result[category].' -> '.$result[service].'</td></tr>
  10. <tr><td class=property>parametr:</td><td class=value>wartosc</td></tr>
  11. <tr><td class=property>parametr:</td><td class=value>'.nl2br($_POST['pole_z_formularza']).'</td></tr>
  12. <tr><td class=property>parametr:</td><td class=value>'.nl2br($_POST['pole_z_formularza']).'</td></tr>
  13. <tr><td class=property>parametr:</td><td class=value>'.date('d-m-Y / H:i',$result[pole_z_tabeli]).'</td></tr></table>
  14. <p>PRZYKLADOWY TEKST</p>
  15. ';
  16. include('footer.php');
  17. $headers ='MIME-Version: 1.0'."\n";
  18. $headers .='Content-type: text/html; charset=iso-8859-2'."\n";
  19. $headers .='Content-Transfer-Encoding: 8bit'."\n";
  20. $headers .='From: admin@domainpl'."\n";
  21. $mailsent = mail($to,$subject,$message,$headers);


Ten post edytował XxmanxX 16.10.2009, 14:21:15
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 16.10.2025 - 02:01