Autor | Zpráva | ||
---|---|---|---|
Anonymní Profil * |
#1 · Zasláno: 16. 11. 2006, 11:40:27
Zdravim chci rozesilat vsem registrovanym uzivatelom stejny Informacny mail.
Ale chci aby se pro odesilani pouzilval smtp server mojho emailu. tj.yahoo.com ako upravit tie dva php scripty? ---------------------------------------------------------------------- ----------------------------------------------- ---------------------------------------------------------------------- ----------------------------------------------- config.php <? error_reporting(0); $listfile = "list.txt"; $headerfile = "header.txt"; // The header for an email message (when in admin you can choose not to include it) $footerfile = "footer.txt"; // The footer for an email message (when in admin you can choose not to include it) $adminusername = "admin"; // Username for logging in to mailadmin.php $adminpassword = "heslo"; // password for logging in to mailadmin.php $fromemail = "moj@email.cz"; // Email address the emails will be sent from. $welcome = "welcome.html"; // file it redirects to after signing up $goodbye = "goodbye.html"; // file it redirects to after removing yourself from the list $error = "error.html"; // file it redirects to if its in invalid email etc ?> $welcome = "welcome.html"; // file it redirects to after signing up $goodbye = "goodbye.html"; // file it redirects to after removing yourself from the list $error = "error.html"; // file it redirects to if its in invalid email etc ?> ---------------------------------------------------------------------- ----------------------------------------- ---------------------------------------------------------------------- ----------------------------------------- mailadmin.php <? if (!$PHP_AUTH_USER || !$PHP_AUTH_PW) { // If empty, send header causing dialog box to appear header('WWW-Authenticate: Basic realm="Mailing List admin"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else { $tu = strtolower($PHP_AUTH_USER); $pu = strtolower($PHP_AUTH_PW); include("config.php"); if ($tu == strtolower($adminusername) && $pu == strtolower($adminpassword)) { $fd = fopen ($listfile, "r"); $contents = fread ($fd, filesize ($listfile)); fclose ($fd); $entries = explode(",",$contents); for($i=0;$i<count($entries);$i++) { if ($entries[$i] != "") $choices .= "<OPTION VALUE=\"$entries[$i]\"> ".$entries[$i]."\n"; } if ($cmd != "send") { $output = " <form action=\"?cmd=send\" method=\"post\"> <table align=\"left\"> <tr> <td> <SELECT MULTIPLE SIZE=5 NAME=sendto[]> <OPTION VALUE=\"All\" selected>Send to All $choices </select> </td> </tr> </table> <table align=\"center\"> <tr> <td nowrap>Msg Subject</td><td><input type=\"text\" size=\"30\" name=\"subject\"></td> </tr> <tr> <td nowrap valign=\"top\">Msg Body</td><td><textarea name=\"body\" rows=\"8\" cols=\"50\"></textarea></td> </tr> <tr> <td></td> <td><input type=\"checkbox\" name=\"useheader\" value=\"yes\"> Include Header <input type=\"checkbox\" name=\"usefooter\" value=\"yes\"> Include Footer</td> </tr> <tr> <td></td> <td><input type=\"submit\" value=\"Send Mail\"></td> </tr> <tr> <td></td> <td>Please keep in mind that it may take a while to send the messages depending how many people are on your list, let it finish sending</td> </tr> </table> "; }else { for ($i=0;$i<count($sendto);$i++) { echo "".$sendto[$i]." <br>"; } $footerd = fopen ($footerfile, "r"); $thefooter = fread ($footerd, filesize ($footerfile)); fclose ($footerd); $headerd = fopen ($headerfile, "r"); $theheader = fread ($headerd, filesize ($headerfile)); fclose ($headerd); if ($useheader == "yes") $message .= "".$theheader."\n\n"; $message .= "".$body."\n\n"; if ($usefooter == "yes") $message .= "".$thefooter.""; if ($sendto[0] == "All") { for($i=0;$i<count($entries);$i++) { mail($entries[$i], $subject, $message, "From: ".$fromemail.""); } } else { for($i=0;$i<count($sendto);$i++) { mail($sendto[$i], $subject, $message, "From: ".$fromemail.""); } } $output = "sent"; } echo $output; } else // Does output if username/password is incorrect { echo " <html><body>Invalid Login/Password</body></html> "; } } ---------------------------------------------------------------------- ---------------------------------------- Nekdo radil tohle ale nevim jak a kde to dat aby to fungovalo. $mail->IsSMTP(); // send via SMTP $mail->Host = "smtp.sever.com"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "nick"; // SMTP username $mail->Password = "heslo"; // SMTP password |
||
tiso Profil |
#2 · Zasláno: 16. 11. 2006, 11:49:13
SMTP server je nastavený v php.ini na hostingu, takže ho nezmeníš...
|
||
jrm Profil * |
#3 · Zasláno: 16. 11. 2006, 11:56:54
No a nešlo by to rozesílat přímo z vlastního PC (localhost) a tam si v php.ini nadefinovat SMTP jak potřebuješ?
|
||
P_T_ Profil |
#4 · Zasláno: 16. 11. 2006, 13:51:01
Možná by to šlo pomocí třídy class.phpmailer.php ( class.smtp.php ).
Což je právě to $mail->IsSMTP(); // send via SMTP $mail->Host = "smtp.sever.com"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "nick"; // SMTP username $mail->Password = "heslo"; // SMTP password Samozřejmě můžeš narazit na firewall hostingu |
||
Anonymní Profil * |
#5 · Zasláno: 16. 11. 2006, 20:44:34
Tak fajn a ako by sa potom mal uprait ten script... poprosim o upravu
|
||
P_T_ Profil |
#6 · Zasláno: 16. 11. 2006, 20:57:27
Script si uprav sám :-)
Tady máš orientační mustr. // sestavení emailu require("class.phpmailer.php"); $mail = new phpmailer(); $mail->Mailer = 'smtp'; $mail->Host = 'vzdálený SMTP'; $mail->Port = 25; $mail->SMTPAuth = True; $mail->Username = 'Přihlašovací jméno'; $mail->Password = 'Heslo'; $mail->Priority = 3; $mail->Encoding = "8bit"; $mail->CharSet = "windows-1250"; $mail->From = "tvoje@domena.cz"; $mail->FromName = "Tvoje Jméno"; $mail->AddAddress('posli.na@adresu.cz); $mail->AddBCC('skryta@adresa.cz); $mail->WordWrap = 50; $mail->IsHTML(true); $mail->Subject = 'Předmět'; $mail->Body = $zprava ; $mail->AltBody = $zprava ; // zaslání emailu if(!$mail->Send()) ... |
||
Anonymní Profil * |
#7 · Zasláno: 17. 11. 2006, 18:11:13
Tak ja to ale neviem
|
||
Časová prodleva: 14 dní
|
|||
Anonymní Profil * |
#8 · Zasláno: 1. 12. 2006, 10:17:31
Prosim upravte mi to php
|
||
Časová prodleva: 19 let
|
Toto téma je uzamčeno. Odpověď nelze zaslat.
0