Добро пожаловать! Это — архивная версия форумов на «Хакер.Ru». Она работает в режиме read-only.
 

Нужен скрипт для оnправки email

Пользователи, просматривающие топик: none

Зашли как: Guest
Все форумы >> [Веб-программинг] >> Нужен скрипт для оnправки email
Имя
Сообщение << Старые топики   Новые топики >>
Нужен скрипт для оnправки email - 2011-10-14 22:29:47.983333   
luckyxakep

Сообщений: 85
Оценки: 0
Присоединился: 2011-03-30 11:03:40.433333
Поделитесь скриптом для автоматической отправки email из списка адресов. С возможностью отправки HTML письма.
Буду очень благодарен.:)
Post #: 1
RE: Нужен скрипт для оnправки email - 2011-10-18 06:38:01.823333   
inx_x

Сообщений: 3
Оценки: 0
Присоединился: 2011-10-17 18:32:34.743333
Могу написать за 1-2 бакса.
Post #: 2
RE: Нужен скрипт для оnправки email - 2011-10-18 20:14:32.086666   
FvCeat

Сообщений: 39
Оценки: 0
Присоединился: 2011-05-31 13:40:58.576666
&lt;?php // // ================================================================ // M A S S E - M A I L E R // ================================================================ // // The script sends e-mails to different e-mail addresses specified // in different text files. The text files can be changed and saved // over a web interface. // // Copyright (C) 2003, Patrick Biegel // $version = "Version 1.0 / 22.02.2003"; // // ================================================================ // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, // MA 02111-1307 USA // // ================================================================ // // // ===================== CONFIGURATION BEGIN ====================== // // // If $stopmail is set to 1 there will be sent just a confirmation // message ! All other E-Mails will not be sent ! This is only for // testing ! If you want to send E-Mails set the value to 0 ! // $stopmail = 0; // // E-mail address of the sender. // $senderemail = "max.muster@sample.com"; // // Address for the confirmation E-mail. // $confirmationemail = "max.muster@sample.com"; // // Value of the subject at the beginning. // $mailsubject = "E-Mailer"; // // Path of the list directory. // $listdir = "/var/www/emailer/lists/"; // // Names of the address files. // $address01 = "address01.txt"; $address02 = "address02.txt"; $address03 = "address03.txt"; $address04 = "address04.txt"; $address05 = "address05.txt"; $address06 = "address06.txt"; $address07 = "address07.txt"; $address08 = "address08.txt"; $address09 = "address09.txt"; $address10 = "address10.txt"; // // Wait time before sending the next E-Mail. // // The time has to be in seconds ! // $waittime = 0.2; // // ====================== CONFIGURATION END ======================= // // ================================================================ // Display html header with the style sheet definitions. // ================================================================ // switch($todo) { case "": $page = "E-Mail Form"; break; case "Change this list !": $page = "Change List"; break; case "Save this List !": $page = "Save List"; break; case "Send E-Mails !": $page = "Send E-Mails"; break; } ?&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Mass E-Mailer&lt;/title&gt; &lt;style type="text/css"&gt; &lt;!-- body { font-family:arial; background-color:#99CCFF } h1 { font-size:20pt; } a:link { color:#000066; text-decoration:none } a:visited { color:#000066; text-decoration:none } a:active { color:#CC0033; text-decoration:none } .tableleft { color:#000066; font-size:12pt; font-weight:bold; vertical-align:top; width:260px; } .bottomtable { width:600px; } .bottomcell { text-align:center; } .linkcell { text-align:center; font-size:14pt; width:150px; } .copyright { text-align:center; font-size:10pt; color:#CC0033; } --&gt; &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;table width="100%" height="100%"&gt; &lt;tr&gt; &lt;td&gt; &lt;form method="post" action="emailer.php"&gt; &lt;table align="center"&gt; &lt;tr&gt; &lt;td&gt; &lt;h1&gt; Mass E-Mailer - &lt;?php echo $page; ?&gt; &lt;/h1&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php if($todo == "") { // ================================================================ // Display E-Mail form. // ================================================================ // ?&gt; &lt;table align="center" cellspacing="1"&gt; &lt;tr&gt; &lt;td class="tableleft"&gt; Path to the recipient address file: &lt;/td&gt; &lt;td&gt; &lt;select name="addressfile" size="1"&gt; &lt;option&gt; &lt;?php echo $address01; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address02; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address03; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address04; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address05; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address06; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address07; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address08; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address09; ?&gt; &lt;/option&gt; &lt;option&gt; &lt;?php echo $address10; ?&gt; &lt;/option&gt; &lt;/select&gt; &lt;input type="submit" name="todo" value="Change this list !"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="tableleft"&gt; Path to a special file: &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="specialfile" size="60"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="tableleft"&gt; Wait time for sending (in sec.): &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="wait" size="10" value="&lt;?php echo $waittime; ?&gt;"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="tableleft"&gt; E-Mail address of the sender: &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="sender" size="60" value="&lt;?php echo $senderemail; ?&gt;"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="tableleft"&gt; E-Mail address for confirmation: &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="confirmation" size="60" value="&lt;?php echo $confirmationemail; ?&gt;"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="tableleft"&gt; E-Mail subject: &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="subject" size="60" value="&lt;?php echo $mailsubject ?&gt;"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="tableleft"&gt; E-Mail message: &lt;/td&gt; &lt;td&gt; &lt;textarea name="message" rows="14" cols="50"&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table align="center" class="bottomtable"&gt; &lt;tr&gt; &lt;td&gt; &nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="bottomcell"&gt; &lt;input type="reset" name="reset" value="Reset Form"&gt; &lt;input type="submit" name="todo" value="Send E-Mails !"&gt; &lt;?php if($stopmail == 1) { echo "&lt;b&gt;Testmode active !&lt;/b&gt;"; } ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php } if($todo == "Change this list !") { // ================================================================ // Change lists. // ================================================================ // // ================================================================ // Display title for the change form. // ================================================================ // ?&gt; &lt;table align="center"&gt; &lt;tr&gt; &lt;td&gt; &lt;b&gt; Open file: &lt;?php echo $addressfile; ?&gt; &lt;/b&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php // ================================================================ // Try to open the selected address file. // ================================================================ // $success = 0; echo "&lt;tr&gt;"; echo "&lt;td&gt; "; $address = $listdir.$addressfile; if (@file_exists($address)) { if($changefile = @fopen ($address, "r")) { // echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; was opened successfuly !&lt;br&gt;"; $success = 1; } else { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; could not be opened !&lt;br&gt;"; } } else { echo "There is no file &lt;b&gt;\"".$address."\"&lt;/b&gt; !&lt;br&gt;"; } echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; // ================================================================ // Insert data to the textbox. // ================================================================ // if ($success == 1) { echo "&lt;tr&gt;"; echo "&lt;td&gt; "; echo "&lt;textarea name=\"email\" rows=\"23\" cols=\"70\"&gt;"; while($line = @fgets($changefile,1024)) { echo @trim(stripslashes($line))."\n"; } echo"&lt;/textarea&gt;"; echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; // ================================================================ // Close the address file. // ================================================================ // echo "&lt;tr&gt;"; echo "&lt;td&gt; "; if(@fclose ($changefile)) { // echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; was closed successfuly !&lt;br&gt;"; } else { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; could not be closed !&lt;br&gt;"; } echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;/table&gt;"; } // ================================================================ // Display buttons. // ================================================================ // ?&gt; &lt;table align="center" class="bottomtable"&gt; &lt;tr&gt; &lt;td&gt; &nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="bottomcell"&gt; &lt;input type="reset" name="todo" value="Reset Form"&gt; &lt;input type="submit" name="todo" value="Save this List !"&gt; &lt;input type="hidden" name="listdir" value="&lt;?php echo $listdir; ?&gt;"&gt; &lt;input type="hidden" name="addressfile" value="&lt;?php echo $addressfile; ?&gt;"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php } if($todo == "Save this List !") { // ================================================================ // Save changes to text file. // ================================================================ // // ================================================================ // Try to open the selected address file. // ================================================================ // $success = 0; echo "&lt;table align=\"center\"&gt;"; echo "&lt;tr&gt;"; echo "&lt;td&gt; "; $address = $listdir.$addressfile; if (@file_exists($address)) { if($savefile = @fopen ($address, "w")) { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; was opened successfuly !&lt;br&gt;"; $success = 1; } else { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; could not be opened !&lt;br&gt;"; } } else { echo "There is no file &lt;b&gt;\"".$address."\"&lt;/b&gt; !&lt;br&gt;"; } echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; // ================================================================ // Write data in to the address file. // ================================================================ // if ($success == 1) { echo "&lt;tr&gt;"; echo "&lt;td&gt; "; if (!@fwrite($savefile,$email)) { echo "Cannot write to file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; !&lt;br&gt;"; echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;tr&gt;"; echo "&lt;td&gt; "; echo "The file permission has to be &lt;b&gt;777&lt;/b&gt; !"; echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } else { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; was saved successfuly !"; } echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; // ================================================================ // Close the address file. // ================================================================ // echo "&lt;tr&gt;"; echo "&lt;td&gt; "; if(@fclose ($savefile)) { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; was closed successfuly !&lt;br&gt;"; } else { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; could not be closed !&lt;br&gt;"; } echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;/table&gt;"; } // ================================================================ // Reset the variable $todo to get back to the E-Mail form. // ================================================================ // $todo == ""; } if($todo == "Send E-Mails !") { // ================================================================ // Sending the E-Mails. // ================================================================ // // ================================================================ // The variables are initialized. // ================================================================ // $status = ""; // Describes the mailing status. $counter = 0; // Counts the E-Mails which has been sent. // ================================================================ // Display title for the protocol. // ================================================================ // echo "&lt;table align=\"center\"&gt;"; echo "&lt;tr&gt;"; echo "&lt;td&gt;"; echo "&lt;hr&gt;"; // ================================================================ // Check if there is a special file to open or if it's necessary // to choose a address list from the drop down menu. // ================================================================ // if ($specialfile != "") { echo "There was an input in the \"special path\" field ...&lt;br&gt;"; $address = $specialfile; } else { echo "There was no input in the \"special path\" field ...&lt;br&gt;"; $address = $listdir.$addressfile; } // ================================================================ // Try to open the selected address file. // ================================================================ // echo "Try to open the file &lt;b&gt;\"".$address."\"&lt;/b&gt; ...&lt;br&gt;"; if (@file_exists($address)) { echo "The file &lt;b&gt;\"".$address."\"&lt;/b&gt; was found ...&lt;br&gt;"; if($afile = @fopen ($address, "r")) { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; was opened successfuly !&lt;br&gt;"; } else { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; could not be opened !&lt;br&gt;"; } } else { echo "There is no file &lt;b&gt;\"".$address."\"&lt;/b&gt; !&lt;br&gt;"; $status = "There is no file \"".$address."\" ..."; } // ================================================================ // If the file exists then reads addresses until end of file. // ================================================================ // echo "Trying to read the file &lt;b&gt;\"".$address."\"&lt;/b&gt; ...&lt;br&gt;"; if (@file_exists($address)) { while (!feof($afile)) { // ================================================================ // Reads one line. // ================================================================ // $line = fgets($afile, 1024); $line = trim($line); echo "&lt;br&gt;"; echo "Reading the address &lt;b&gt;\"".$line."\"&lt;/b&gt; ...&lt;br&gt;"; // ================================================================ // Initialize the address cache. // ================================================================ // $recipient = ""; // ================================================================ // Insert new address to cache. // ================================================================ // $recipient = $line; // ================================================================ // Prepare the header for the e-mail. // ================================================================ // $header = "From: ".$sender."\r\n"; $header .= "Reply-To: ".$sender."\r\n"; $header .= "Errors-To: ".$sender."\r\n"; $header .= "X-Mailer: PHP / ".phpversion()."\r\n"; // ================================================================ // Create test pattern. // ================================================================ // $pattern="#^[-!\#$%&\"*+\\./\d=?A-Z^_|'a-z{|}~]+"; $pattern.="@"; $pattern.="[-!\#$%&\"*+\\/\d=?A-Z^_|'a-z{|}~]+\."; $pattern.="[-!\#$%&\"*+\\./\d=?A-Z^_|'a-z{|}~]+$#"; // ================================================================ // Check if recipient E-Mail address is not empty. // ================================================================ // if($recipient != "") { // ================================================================ // Check if recipient E-Mail address is valid. // ================================================================ // if(preg_match($pattern,$recipient)) { // ================================================================ // Sending the e-mail to the recipient. // ================================================================ // echo "Sending an E-Mail to &lt;b&gt;\"".$recipient."\"&lt;/b&gt; ...&lt;br&gt;"; if($stopmail != "1") { if(@mail($recipient, stripslashes($subject), stripslashes($message), stripslashes($header))) { $counter = $counter + 1; echo "E-Mail &lt;b&gt;\"".$counter."\"&lt;/b&gt; at ".date("H:i:s")." was sent successfuly !&lt;br&gt;"; } else { echo "This E-Mail could not be sent !&lt;br&gt;"; } } else { $counter = $counter + 1; echo "E-Mail &lt;b&gt;\"".$counter."\"&lt;/b&gt; at ".date("H:i:s")." was sent successfuly (Testmode) !&lt;br&gt;"; } } else { echo "The recipient E-Mail address is not valid !"; echo "&lt;br&gt;"; } } else { echo "The recipient E-Mail address is empty or it is the end of data !"; echo "&lt;br&gt;"; } // ================================================================ // If necessary and the E-Mails can not send that fast here is // a loop to make a little break after all E-Mails. // ================================================================ // $sec = $wait * 1000000; usleep($sec); } // ================================================================ // Check if confirmation E-Mail address is not empty. // ================================================================ // if($confirmation != "") { // ================================================================ // Check if confirmation E-Mail address is valid. // ================================================================ // if(preg_match($pattern,$confirmation)) { // ================================================================ // Sending a confirmation E-Mail. // ================================================================ // echo "&lt;br&gt;"; echo "Sending a confirmation E-Mail to &lt;b&gt;\"".$confirmation."\"&lt;/b&gt; ...&lt;br&gt;"; $subject = "Confirmation - ".$subject; if(@mail($confirmation, stripslashes($subject), stripslashes($message), stripslashes($header))) { $counter = $counter + 1; echo "E-Mail &lt;b&gt;\"".$counter."\"&lt;/b&gt; at ".date("H:i:s")." was sent successfuly !&lt;br&gt;"; } else { echo "This E-Mail could not be sent !&lt;br&gt;"; } } else { echo "&lt;br&gt;"; echo "The confirmation E-Mail address is not valid !"; } } else { echo "&lt;br&gt;"; echo "The confirmation E-Mail address is empty !"; } // ================================================================ // Close the address file. // ================================================================ // echo "&lt;br&gt;"; if(@fclose ($afile)) { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; was closed successfuly !&lt;br&gt;"; } else { echo "The file &lt;b&gt;\"".$addressfile."\"&lt;/b&gt; could not be closed !&lt;br&gt;"; } } else { echo "Could not read the file &lt;b&gt;\"".$afile."\"&lt;/b&gt; ...&lt;br&gt;"; } // ================================================================ // If everything is OK the status message displays the number // of sent E-Mails. // ================================================================ // if ($status == "") { $status ="Status: ".$counter." E-Mails were sent !"; echo "&lt;br&gt;"; echo "$status"; echo "&lt;hr&gt;"; echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;/table&gt;"; } } // ================================================================ // Display html footer with a close link. // ================================================================ // ?&gt; &lt;table align="center" class="bottomtable"&gt; &lt;tr&gt; &lt;td colspan="4"&gt; &nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="linkcell"&gt; &lt;a href="javascript:window.close()"&gt; Close Window &lt;/a&gt; &lt;/td&gt; &lt;td class="linkcell"&gt; &lt;a href="emailer.php"&gt; E-Mail Form &lt;/a&gt; &lt;/td&gt; &lt;td class="linkcell"&gt; &lt;a href="javascript:history.back()"&gt; Back &lt;/a&gt; &lt;/td&gt; &lt;td class="linkcell"&gt; &lt;a href="docu/emailer.pdf" target="_blank"&gt; Help &lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="4"&gt; &nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="4" class="copyright"&gt; &copy; 2003 by &lt;a href="mailto:biegel@gmx.ch"&gt;Patrick Biegel&lt;/a&gt;, &lt;?php echo $version; ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/table&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt;[/code]
Post #: 3
RE: Нужен скрипт для оnправки email - 2011-10-22 21:49:08.960000   
luckyxakep_antiban

Сообщений: 44
Оценки: 0
Присоединился: 2011-10-20 16:02:05.646666
почему то не отправляет. в чем дело?
Post #: 4
Страниц:  [1]
Все форумы >> [Веб-программинг] >> Нужен скрипт для оnправки email







Связаться:
Вопросы по сайту / xakep@glc.ru

Предупреждение: использование полученных знаний в противозаконных целях преследуется по закону.