Norbit_24
(Sobladen)
5 Czerwiec 2010 08:08
#1
Witam,
Jak wysyłać maila do użytkowników strony? Tzn. lista maili będzie wyciągana z bazy danych.
W mailu chcę podać linka do mojej strony w html, żeby mogli sobie w niego kliknąć.
Będzie to wiadomość informacyjna o nowej wersji.
Proszę o jakiś edytor, który spełni moje oczekiwania. I żeby maile nie lądowały w spamie.
Z góry dzięki.
matiit
(matiit)
5 Czerwiec 2010 09:40
#2
Pobierasz maile z bazy danych.
http://pl.php.net/manual/en/book.mail.php
I używasz tejfunkcji.
Norbit_24
(Sobladen)
5 Czerwiec 2010 09:46
#3
dzięki,
Zapomniałem dodać, że gdy wysyłam maile funkcja mail() nie działaja linki html
Strona.pl
Ale działa:
system
(system)
5 Czerwiec 2010 10:36
#4
Norbit_24
(Sobladen)
5 Czerwiec 2010 11:20
#5
Bo ja za każdym razem próbuję wysłać maila z formularza co nie działa.
Z pliku, działa:
//add From: header
$headers = "From: nkegergerz@gmail.com\r\n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
//unique boundary
$boundary = uniqid("HTMLDEMO");
//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
//plain text version of message
$body = "--$boundary\r\n" .
"Content-Type: text/plain; charset=ISO-8859-2\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode("This is the plain text version!"));
//HTML version of message
$body .= "--$boundary\r\n" .
"Content-Type: text/html; charset=ISO-8859-2\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode("This the HTML version!
Strona.pl"));
//send message
mail("nkereererz@gmail.com", $temat1, $body, $headers);[/code]
A formularzem nie działa:
[code]if(isset($_GET[‘mail’]) && $_GET[‘mail’]==‘wyslij’) { $temat1 = “$_POST[temat]”; $message1 = $_POST[“tresc_maila”]; //add From: header $headers = “From: nkushgfhz@gmail.com \r\n”; //specify MIME version 1.0 $headers .= “MIME-Version: 1.0\r\n”; //unique boundary $boundary = uniqid(“HTMLDEMO”); //tell e-mail client this e-mail contains//alternate versions $headers .= “Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n”; //plain text version of message $body = “–$boundary\r\n” . “Content-Type: text/plain; charset=ISO-8859-2\r\n” . “Content-Transfer-Encoding: base64\r\n\r\n”; $body .= chunk_split(base64_encode(“This is the plain text version!”)); //HTML version of message $body .= “–$boundary\r\n” . “Content-Type: text/html; charset=ISO-8859-2\r\n” . “Content-Transfer-Encoding: base64\r\n\r\n”; $body .= chunk_split(base64_encode($message1)); //send message mail("nkxcvxcrz@gmail.com ", $temat1, $body, $headers); echo ‘Poszło’; } ?>
| Treść wiadomości: | |
| Temat: | |
| |
Proszę to sprawdzić.
Z góry dzięki.
system
(system)
5 Czerwiec 2010 16:00
#6
Bo wysyłasz metodą Post a nie Get. nie mam tego jak sprawdzić ale zrobienie czegoś takiego:
action="mail2.php?mail=wyslij"
nie ustawi ci zmiennej GET w phpie ponieważ serwer (zakładam, że apache) ustawia zmienne POST i GET tylko w zależności od nagłówka http a tam masz pewnie coś takiego
POST /mail2.php?mail=wyslij HTTP/1.1
...
Innymi słowy zamień to:
if(isset($_GET['mail']) && $_GET['mail']=='wyslij')
na to:
if isset($_POST['submit'])
Gandio
(Gandio)
6 Czerwiec 2010 10:51
#7
zapoznaj sie z tym to nawet zalaczniki bedziesz mogl wysylac
http://phpedia.pl/wiki/Phpmailer