Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Powiadomienie o nowym komentarzu
Strarus
post
Post #1





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


siema
Jak mogę zrobić automatyczne powiadamianie mnie o tym, że ktoś dodał komentarz na stronie? Tylko nie gotowce (IMG:http://forum.php.pl/style_emoticons/default/haha.gif)
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




a nie mozesz poprostu wyslac do siebie maila? Dopisz kod do dodawania komentarza, ktory bedzie slal do ciebie maila.

Inne rozwiązanie to np. rss. Zrob sobie rss z komentarzy i go zasubskrybuj (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Strarus
post
Post #3





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


Ok, odpowiada mi opcja z dodaniem kodu wysyłania maila. Jakich funkcji muszę użyć??
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Uzyj klasy PHPMailer. W google znajdziesz strone domową a w niej klasy i przyklady uzycia
Go to the top of the page
+Quote Post
Strarus
post
Post #5





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


Próbowałem ale mi nie wyszło.... Z tąd brałem podpowiedzi: http://60free.ovh.org/pl/support/support_g...sPhpMailer.html ... Niesty nie działa... :
conf:
Kod
<?
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();

$mail->PluginDir = "phpmailer/";
$mail->From = "powiadomienie_o_nowym_komentarzu@wp.pl"; //adres naszego konta
$mail->FromName = "phpMailer tester";//nagłówek From
$mail->Host = "smtp.wp.pl";//adres serwera SMTP
$mail->Mailer = "smtp";
$mail->Username = "powiadomienie_o_nowym_komentarzu@wp.pl";//nazwa użytkownika
$mail->Password = "*******";//nasze hasło do konta SMTP
$mail->SMTPAuth = true;
$mail->SetLanguage("en", "phpmailer/language/");

$mail->Subject = "Mail testowy";//temat maila

// w zmienną $text_body wpisujemy treść maila
$text_body = "Cześć, chyba phpMailer działa \n\n";
$text_body .= "Na zawsze Twój, \n";
$text_body .= "PHPMailer";

$mail->Body = $text_body;
// adresatów dodajemy poprzez metode 'AddAddress'
$mail->AddAddress("******@********","******");

if(!$mail->Send())
echo "There has been a mail error <br>";
echo $mail->ErrorInfo."<br>";

// Clear all addresses and attachments
$mail->ClearAddresses();
$mail->ClearAttachments();
echo "mail sent <br>";
?>


PS. oto błąd:

Kod
There has been a mail error
SMTP Error: Could not connect to SMTP host.
mail sent
Go to the top of the page
+Quote Post
Moli
post
Post #6





Grupa: Zarejestrowani
Postów: 662
Pomógł: 45
Dołączył: 26.03.2007
Skąd: Warszawa

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


A ni mozesz w panelu wystwietlić komentarze sortujac po dacie dodania ? Przywiększej ilości komentarzy zabijesz sam siebie tymi meilami (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Strarus
post
Post #7





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


hehe, właśnie chodzi mi o to, żeby się czegoś nauczyć (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) mam sortowanie od najnowszego do najstarszego i wszystko (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) właśnie o maila, albo gg mi chodzi (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) może wp nie jest kompatybilne?
Go to the top of the page
+Quote Post
pyro
post
Post #8





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

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


tylko po co tutaj PHPMailer...?

Porponuje użyć poprostu funkcji mail();
Go to the top of the page
+Quote Post
nospor
post
Post #9





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Cytat
tylko po co tutaj PHPMailer...?
Bo jest zdecydowanie lepsze i przyjaźniejsze od mail() (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
mail() to przezytek.
Go to the top of the page
+Quote Post
Strarus
post
Post #10





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


hehe, ale mail() mi od razu zadziałało (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) ale może jednak ktoś pomoże z mailerem (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
pyro
post
Post #11





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

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


Bueheh... stary ale jary, myślę , że tutaj wsytarczy (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

  1. <?php
  2. $mail->Host = "smtp.wp.pl";//adres serwera SMTP
  3. ?>


sprobuj localhost
Go to the top of the page
+Quote Post
Strarus
post
Post #12





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


ale w sensie, że do tego phpmailer?
Go to the top of the page
+Quote Post
mike
post
Post #13





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Cytat(nospor @ 29.12.2008, 20:03:22 ) *
Bo jest zdecydowanie lepsze i przyjaźniejsze od mail() (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
mail() to przezytek.
Piszesz o przeżytkach i polecasz PHPMailera? (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Dużo lepszym rozwiązaniem jest Swift (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post
nospor
post
Post #14





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




@mike hehe (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Akurat o switf nie slyszalem, a PHPMailer tez dobrze sie ma. Ale w wolnej chwili przyjrze sie twojej propozycji
Go to the top of the page
+Quote Post
Strarus
post
Post #15





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


Jak na razie najlepiej sprawdza się mail() (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)

A jeszcze jedno pytanie (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) :
Czy i jak mogę zrobić polskie znaki w tej funkcji, ponieważ w mailu jest np. treść komentarza to zamiast ść są jakieś znaczki... Jak to rozwiązać? Ps. na stronie mam ISO-8859-2
Go to the top of the page
+Quote Post
Lejto
post
Post #16





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


wyślij nagłówki header z kodowaniem, wersją mime itp zobacz w manualu
Go to the top of the page
+Quote Post
Strarus
post
Post #17





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

Ostrzeżenie: (20%)
X----


A dokładniej? Mój kod wygląda tak:
  1. <?php
  2. if (@mysql_query($sql)) {
  3.      echo '<p>Twój komentarz został dodany.</p>';
  4.  
  5.    $message = "Na stronie ********** zostal dodany komentarz:" . $content_new . " Dodal: " . $nick . " Ip: " . $ip . " WWW: " . $www . " Dnia: " . $data . "";
  6.    mail('****************', 'Dodano komentarz', $message);
  7.    } else {
  8.      echo '<p>Bład podczas dodawania komentarza: ' .
  9.          mysql_error() . '</p>';
  10.    }
  11. ?>


I jak to teraz zmienić aby były polskie znaki?
Go to the top of the page
+Quote Post
Lejto
post
Post #18





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


np.
  1. <?php
  2. ///
  3.  
  4. $header .= "MIME-Version: 1.0\n";
  5.  $header .= "Content-type: text/html; charset=iso-8859-2\n";
  6.  $header .= "Return-Path: <$mail>";
  7.  
  8. ///
  9.    mail('****************', 'Dodano komentarz', $message,$header)or die('Nie można wysłać wiadomości');
  10. ;
  11. ///
  12. ?>

tak ja mam
Go to the top of the page
+Quote Post
AxZx
post
Post #19





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 55
Dołączył: 1.03.2005
Skąd: śląsk

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


Cytat(mike @ 29.12.2008, 20:13:11 ) *
Piszesz o przeżytkach i polecasz PHPMailera? (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Dużo lepszym rozwiązaniem jest Swift (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)


a będzie teraz wojna na temat tego która aplikacja lepsza albo starsza?(IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
phpmailer - ostatnia aktualizacja w listopadzie 2008
swiftmailer - ostatnia aktualizacja w marcu 2008

phpmailer wg mnie nie jest przeżytkiem:)
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: 26.09.2025 - 08:01