Jump to content
elhefe12

Php mailer

Recommended Posts

Posted (edited)


<?php
function get_rand_id($length=2, $uselower=1, $useupper=0, $usespecial=0, $usenumbers=1, $prefix='') {
$key = $prefix;
srand((double)microtime() * rand(1000000, 9999999));
$charset = "";
if ($uselower == 1) $charset .= "abcdefghijkmnopqrstuvwxyz";
if ($useupper == 1) $charset .= "ABCDEFGHIJKLMNPQRSTUVWXYZ";
if ($usenumbers == 1) $charset .= "0123456789";
if ($usespecial == 1) $charset .= "~#$%^*()_+-={}|][";
while ($length > 0) {
$key .= $charset[rand(0, strlen($charset)-1)];
$length--;
}
return $key;
}
function RFCDate() {
$tz = date("Z");
$tzs = ($tz < 0) ? "-" : "+";
$tz = abs($tz);
$tz = ($tz/3600)*100 + ($tz%3600)/60;
$result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
return $result;
}


$message = file_get_contents('message.html');
$arr = file('mail_list.txt');


$linkpics = 'http://www.site/hap/images';
$href = 'http://www.site/hap/';

///////////////////////////////////////////////////////////////////////////////////////

print 'STARTED SENDING<br>================================================<br>';
$k=0;
foreach($arr as $var){
$theuser = trim($var);
$link = $href.'avs.php?'.get_rand_id(5).'='.get_rand_id(4).'&'.get_rand_id(5).'='.get_rand_id(4).'&'.get_rand_id(5).'='.get_rand_id(4).'&'.get_rand_id(5).'='.get_rand_id(4).'&'.get_rand_id(5).'='.get_rand_id(4).'&'.get_rand_id(6).'='.get_rand_id(4);

$subject = "Hello World";
$fromname = 'Spanac';
$gen = 'id'.get_rand_id(5,0,0,0,1).'-site.com';
$fromaddress = 'message@'.$gen;

$header = "From: \"".$fromname."\" <".$fromaddress.">\r\n";
$header .= "Reply-To: ".$fromaddress." \r\n";
$header .= "Content-Type: text/html\r\n";
$header .= "Date: " . RFCDate() . "\r\n";
$header .= "Return-Path: ". $fromaddress ."\r\n";
$header .= "Message-ID: ".md5(uniqid(time()))."@".$gen."\r\n";
$header .= "X-Priority: 5\r\n\n";

$msg = str_replace('_images_', $linkpics, $message);
$msg = str_replace('_link_', $link, $msg);

$k++;
$mailit = mail($theuser, $subject, $msg, $header);
print $k.'. Sending to: '.$theuser.' ... ';
if($mailit){
print 'Sent! <br>';
$fp = fopen('log',"a+");
fwrite($fp,"$theuser\tSent!\r\n");
fclose($fp);
} else {
print 'Not Sent! <br>';
$fp = fopen('log',"a+");
fwrite($fp,"$theuser\tNot Sent!\r\n");
fclose($fp);
}
}

?>

Creati message.html si la directorul de poze puneti : _images_ si daca aveti link ceva puneti : _link_

Edited by aelius
pentru o formatare corecta foloseste tag-urile [PHP] si [/PHP]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...