day & night

скрипт отправки писем от чужого имени, Поиск скриптов
Дата обновления: , перейти к новому сообщению
#1
Odissei



Бывалый
*

Группа: Пользователи
Сообщений: 49
Регистрация: 13.01.2006
Пользователь №: 107.005


Респектов: 0
----------


Предупреждений:


Нужен PHP скрипт отправки писем от чужого имени. Облазил весь поисковик, но в основном фигня всякая - нужно чтобы слать можно было емайл от любого имени(автор), адреса, чтобы HTML поддерживал.....было бы неплохо если бы он еще имел возможность массовой рассылки - по диапозону....было бы очень хорошо если бы смс еще также слать можно было.

Благодарю за внимание.
User is offline
Go topGo end
 

Ответов(1 - 3)
12.01.2008 - 11:55
#2
Odissei



Бывалый
*

Группа: Пользователи
Сообщений: 49
Регистрация: 13.01.2006
Пользователь №: 107.005


Респектов: 0
----------


Предупреждений:


Скрипт найден, тему можно закрыть.
User is offline
Go topGo end
12.01.2008 - 12:15
#3
PRYANIK



Made In Tula
[SoftoRooMTeaM] Group Icon

Группа: Администраторы
Сообщений: 31.327
Регистрация: 22.02.2004
Пользователь №: 7


Респектов: 6425
-----XXXXX




Цитата | Quote(Odissei @ 12.01.2008 - 11:58)
Скрипт найден
*

Почему бы не поделиться со всеми smile.gif?...


--------------------
Не работает ссылка? Пишите в теме, обновим :)! Link not working? Let us know in the comments, we'll fix it!


Трудно найти слова, когда действительно есть что сказать. Э.М. Ремарк
User is online!
Go topGo end
12.01.2008 - 14:09
#4
Odissei



Бывалый
*

Группа: Пользователи
Сообщений: 49
Регистрация: 13.01.2006
Пользователь №: 107.005


Респектов: 0
----------


Предупреждений:


Цитата | Quote
Почему бы не поделиться со всеми smile.gif?...

не вопрос:
Code
<?php
$message_in_min = 10000;
$mode = $HTTP_POST_VARS['mode'];

switch($mode){
 case 'send':
   if(isset($HTTP_POST_FILES['filename']['tmp_name'])){
     $base_name = $HTTP_POST_FILES['filename']['name'];
     $f = fopen($HTTP_POST_FILES['filename']['tmp_name'],"rb");
     $attach = base64_encode(fread($f,filesize($HTTP_POST_FILES['filename']['tmp_name'])));
     $isfile = 1;
   }
   else {$isfile = 0;}
   # Проверки ##################################################    ###############
   $from = $HTTP_POST_VARS['from'];
   if(empty($from)){echo("Неуказан адрес отправителя");exit;}
   else if(!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i",$from)){echo("$from - не верный адрес отправителя"); exit;}
   $fromname = @$HTTP_POST_VARS['fromname'];
   if(isset($fromname)){$from = $fromname." <$from>";}
   $subject = $HTTP_POST_VARS['subject'];
   $subject =  htmlspecialchars(stripslashes($subject));
   if(!$subject){echo("Опять же, кто будет писать тему сообщения?");}
   $type = $HTTP_POST_VARS['type'];
   $message = $HTTP_POST_VARS['message'];
   if($type == 'text'){$message =  htmlspecialchars(stripslashes($message));}
   if(!$message){echo("Короче, нужно что то написать. Где сообщение-то?"); exit;}
   ##################################################    ##########################
   $to_arr = file(@$HTTP_POST_FILES['to']['tmp_name']);
   // print_r($to_arr);exit;
   $to_arr = array_unique($to_arr);
   $i = 0;
   $current_message= 0;
   $num_send = 0;
   $num_bad  = 0;
   $num_error= 0;
   while(isset($to_arr[$i])){
     $to_arr[$i] = trim($to_arr[$i]);
     if(!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i",$to_arr[$i])){
       echo($to_arr[$i].' - голимый адрес, я на его отправлять ничего не собираюсь'."<br>\n");
       $num_bad++;
     }
     else{
       if(sendemail($from,$to_arr[$i],$subject,$message,$type)){
         echo('Сообщение на '.$to_arr[$i]." отправлено<br>\n"); flush();
         $num_send++;
       }
       else{$num_error++;}
     }
     $current_message++;
     if($current_message == $message_in_min){
       $current_message = 0;
       echo('Отправлено '.$message_in_min.' соообщений. Пауза 60 сек.'."<br>\n");
       flush();
       sleep(30);
       echo('<!---->'."\n");
       flush();
       sleep(30);
     }
     $i++;
   }
   echo('<hr size="1" color="#000000">Рассылка завершена!<br>'."\n");
   echo('
     <b>Отправлено  : '.$num_send.'</b>
     <b>Ошибок связи: '.$num_error.'</b>
     <b>Плохих email: '.$num_bad.'</b>
     <hr size="1" color="#000000">
   ');
 break;
 default:
   echo('
<div align="center">
<h1>Рассылка писем</h1>
<form method="post" enctype="multipart/form-data">
<table align="center" border="0">
<tr>
 <td align="right" bgcolor="#EBEBEB"><strong>От кого (Имя):</strong></td>
 <td><input type="Text" class="inp" name="fromname" value="" size="30"> * - Не обязательно. Например, Пупкин И.И.</td>
</tr>
<tr>
 <td align="right" bgcolor="#EBEBEB"><strong>От кого (Email):</strong></td>
 <td><input type="Text" class="inp" name="from" value="" size="30"> * - Только email адрес</td>
</tr>
<tr>
 <td align="right" bgcolor="#EBEBEB"><strong>Кому:</strong></td>
 <td><input type="File" name="to" class="inp" size="68"></td>
</tr>
<tr>
 <td align="right" bgcolor="#EBEBEB"><strong>Тема:</strong></td>
 <td><input type="Text" class="inp" name="subject" value="" size="80"></td>
</tr>
<tr>
 <td valign="top" align="right" bgcolor="#EBEBEB"><strong>Сообщение:</strong></td>
 <td><textarea name="message" rows="10" cols="82" class="inp"></textarea></td>
</tr>

<tr>
 <td align="right" bgcolor="#EBEBEB"><strong>Формат</strong></td>
 <td>

<table width="100%">
<tr>
 <td width="20"><input class="inp" type="Radio" name="type" value="text" checked></td>
 <td width="40">text    </td>
 <td width="20"><input class="inp" type="Radio" name="type" value="html"></td>
 <td width="40">html</td>
 <td align="right"><input type="Hidden" name="mode" value="send"><input type="Submit" class="inp" value="Отправить"></td>
</tr>
</table>

</td>
</tr>
<tr>
 <td bgcolor="#EBEBEB"></td>
 <td><hr size="3" color="#F7F7F7"></td>
</tr>
</table>
</form>
</div>
');
 break;
}

function sendemail($from,$to,$subject,$message,$type){
 $bound = time().'SPB';
 global $attach, $base_name, $isfile;

 $sep = chr(13).chr(10); // Разделитель строк заголовка
 switch($type){
   case 'text':
     $headers = "From: ".$from.$sep;
     $headers.= "X-Priority: 3".$sep;
     $headers.= "X-MSMail-Priority: Normal".$sep;
     $headers.= "X-Mailer: PHP/".phpversion().$sep;
     $headers.= "MIME-Version: 1.0".$sep;
     $headers.= "Content-Type: multipart/mixed; boundary=\"".$bound."\"".$sep.$sep;

     $body = "--$bound".$sep;
     $body.= "Content-type: text/plain; charset=\"windows-1251\"".$sep;
     $body.= "Content-Transfer-Encoding: 8bit".$sep.$sep;
     $body.= $message.$sep;
     
     if($isfile == 1){
       $body.= "$sep$sep--$bound".$sep;
       $body.= "Content-Type: application/octet-stream;";
       $body.= "name=\"".basename($base_name)."\"".$sep;
       $body.= "Content-Transfer-Encoding:base64".$sep;
       $body.= "Content-Disposition:attachment".$sep.$sep;
       $body.= $attach.$sep;
     }
     // $body.="$bound--".$sep.$sep;
   break;
   case 'html':
     $headers = "From: ".$from.$sep;
     $headers.= "X-Priority: 3".$sep;
     $headers.= "X-MSMail-Priority: Normal".$sep;
     $headers.= "X-Mailer: PHP/".phpversion().$sep;
     $headers.= "MIME-Version: 1.0".$sep;
     $headers.= "Content-Type: multipart/mixed; boundary=\"".$bound."\"".$sep.$sep;

     $body = "--$bound".$sep;
     $body.= "Content-type: text/html; charset=\"windows-1251\"".$sep;
     $body.= "Content-Transfer-Encoding: 8bit".$sep.$sep;
     $body.= $message.$sep;

     if($isfile == 1){
       $body.= "$sep$sep--$bound".$sep;
       $body.= "Content-Type: application/octet-stream;";
       $body.= "name=\"".basename($base_name)."\"".$sep;
       $body.= "Content-Transfer-Encoding:base64".$sep;
       $body.= "Content-Disposition:attachment".$sep.$sep;
       $body.= $attach.$sep;
     }
     // $body.="$bound--".$sep.$sep;
   break;
   default:
     echo('<center><b>Неверный параметр типа письма.</b></center>');
   break;
 }
 if(mail($to,$subject,$body,$headers)){return true;}
 else{return false;}
}
?>

мыльники записываем в тхт файл, а потом уже запускаем через "Кому"
User is offline
Go topGo end

Topic Options
Сейчас: 24.04.2024 - 0:03
Мобильная версия | Lite версия