Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Serwer home i funkcja mail, dwa problemy
matkuz
post
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 26.09.2013

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


Witam,

1) Home akceptuje mi coś takiego, ale w wiadomości nie mam sformatowanego html na normalną wiadomość:
  1. $message .= '</p>-------------<br />';
  2. $message .= '<p>'.$content.'</p>';
  3. $message .= '</body></html>';

itd.

wyświetla mi w wiadomości:
Cytat
</p>-------------<br /><p>wiadomosc</p></body></html>



Nie przyjmuje mi za to wszystkich znaków "\n" itp. O co chodzi i jak to naprawić?

2) Czy na prawde w home.pl nie można wysłać email od dowolnego adresu email do dowolnego adresu email? Zrobiłem tak, że wysyła do wielu, ale email mam wciąż z home.pl


Z góry dzięki za pomoc.

Ten post edytował matkuz 22.05.2015, 10:20:26
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 8)
Turson
post
Post #2





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

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


Radze korzystac z PHPMailer, bo to rozwiąże te problemy
Go to the top of the page
+Quote Post
Pyton_000
post
Post #3





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

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


home.pl dodało ograniczenie że możesz wysyłać tylko z adresu które ma konto na serwerze.

Turson Odczep się od tego PHPMailer (IMG:style_emoticons/default/wink.gif) Wybierz Swift Mailer
Go to the top of the page
+Quote Post
kayman
post
Post #4





Grupa: Zarejestrowani
Postów: 556
Pomógł: 40
Dołączył: 20.07.2012
Skąd: Warszawa

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


na kilku domenach w home wysyłam maile tą klasą którą sobie sam napisałem (IMG:style_emoticons/default/smile.gif) , jedyny warunek to żeby email był na home, nie można wysłać z home emaila z adresu którego nie ma na home

  1. class Mail {
  2.  
  3. private $header;
  4. private $from;
  5. private $to;
  6. private $replyTo;
  7. private $cc;
  8. private $content;
  9. private $title;
  10.  
  11. public function setTo($value) {
  12. $this->to = $value;
  13. }
  14.  
  15. public function setFrom($value) {
  16. $this->from = $value;
  17. }
  18.  
  19. public function setReplyTo($value) {
  20. $this->replyTo = $value;
  21. }
  22.  
  23. public function setCc($value) {
  24. $this->cc = $value;
  25. }
  26.  
  27. public function setTitle($value) {
  28. $this->title = $value;
  29. }
  30.  
  31. public function setContent($value) {
  32. $this->content = $value;
  33. }
  34.  
  35. public function send() {
  36. $this->createHeader();
  37. if (mail($this->to, $this->title, $this->content, $this->header))
  38. return true;
  39. return false;
  40. }
  41.  
  42. private function createHeader() {
  43. $header = array();
  44. if ($this->from)
  45. $header[] = 'From: ' . $this->from;
  46. $header[] = 'MIME-Version: 1.0';
  47. $header[] = 'Content-type: text/html; charset=UTF-8';
  48. if ($this->replyTo)
  49. $header[] = 'Reply-To: ' . $this->replyTo;
  50. if ($this->cc)
  51. $header[] = 'Cc: ' . $this->cc;
  52. $this->header = implode(PHP_EOL, $header);
  53. }
  54.  
  55. }


Ten post edytował kayman 22.05.2015, 11:15:52
Go to the top of the page
+Quote Post
Turson
post
Post #5





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

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


Cytat(Pyton_000 @ 22.05.2015, 12:00:13 ) *
Turson Odczep się od tego PHPMailer (IMG:style_emoticons/default/wink.gif) Wybierz Swift Mailer

A to czemu?
Go to the top of the page
+Quote Post
matkuz
post
Post #6





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 26.09.2013

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


Ok co do 2 to już wiem (IMG:style_emoticons/default/wink.gif)

Da się zrobić jakoś wersje 1 ? Tak aby po prostu wiadomość była formatowana - jakoś prosto?

Ktoś ma pomysł czemu wiadomości w 1) przychodzą niesformatowane? (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Pyton_000
post
Post #7





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

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


Bo nie wrzucasz nagłówków odpowiednich

https://css-tricks.com/sending-nice-html-email-with-php/
Go to the top of the page
+Quote Post
matkuz
post
Post #8





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 26.09.2013

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


ok no to ostatnia rzecz:

daje nagłówki:
  1. $headers = "From: " . strip_tags($email) . "\r\n";
  2. $headers .= "Reply-To: ". strip_tags($email) . "\r\n";
  3. $headers .= "CC: jakisemail@email.pl\r\n";
  4. $headers .= "MIME-Version: 1.0\r\n";
  5. $headers .= "Content-type: text/html; charset=ISO-8859-2\n";
  6. $headers .= "Content-Transfer-Encoding: 8bit\n";


I wiadomość w stylu
  1. $message = '<html><body>';

Jak zrobić aby były polskie znaki? Ja robię coś źle czy znowu home? (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
rad11
post
Post #9





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

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


utf-8
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: 22.08.2025 - 12:28