Sir,
I need the help. The following processing is needed.
- When I send an email and execute the script(www.xxxxx.com), that mail should be distributed to all the emails in that database.
2.That email should have login link of the specific site (www.xxxxx.com).
- When I click the link, it should go to the site staright, without login, username & password(username & password is already in that database).
The script is given below for your information.
<?php
include "private/databaseconnect.php";
//include "idkey.php";
mysql_connect("localhost","user","pass") or die("Unable to connect to SQL server");
mysql_select_db("emg2") or die("Unable to select database");
$server = "mail.server.net";
//$server = "mail.server2.net";
//$server = "mail.server3.net";
$port = 110;
$user = "email@email.com";
$pass = "pass";
//$user = "email2@email.com";
//$pass = "pass2";
mailList('mail.server.net', 110, 'email@email.com', 'pass');
//mailList('mail.server2.net', 110, 'email2@email.com', 'pass2');
//mailList('mail.server3.net', 110, 'email3@email.com', 'pass3');
$subject = '';
$headers = '';
$message = '';
$sender = '';
function mailList($server, $port, $user, $pass){
global $subject, $message, $sender, $headers;
$socket = fsockopen($server, $port);
$line = fgets($socket, 1024);
echo 'Output: '.$line.chr(10);
fputs($socket, "USER $user\r\n");
$line = fgets($socket, 1024);
echo 'Output: '.$line.chr(10);
fputs($socket, "PASS $pass\r\n");
$line = fgets($socket, 1024);
echo 'Output: '.$line.chr(10);
$i = 1;
$run = true;
while ($run){
fputs($socket, "RETR ".$i."\r\n");
$data = '';
$message = "";
$isheaders = true;
$headers = "";
$line = fgets($socket, 1024);
if ($line[0] == '-')
break;
while (($line = fgets($socket, 1024)) <> ".\r\n"){
if (!$line || strlen($line) < 1){
$run = false;
break;
}
$data .= $line;
}
$subject = '';
$message = '';
$sender = '';
$headers = '';
parseData($data);
$message = str_replace("\r","\n",$message);
$subject = str_replace("[AustinNupes]","",$subject);
//$message .= "\r\nemail@email.com sends to all Brothers in Austin\r\nemail2@email.com sends to financial Brothers only";
echo 'BEGIN MESSAGE '.$i."\r\n";
echo 'Subject:[AustinNupes]'.$subject.chr(10);
echo 'Sender: '.$sender.chr(10);
// echo 'Headers: '."From: $sender\r\nTo: \"[AustinNupes]\" <$user>\r\nReply-To: \"[AustinNupes]\" <$user>\r\n$headers".chr(10);
echo 'Message: '.$message.chr(10);
echo 'END MESSAGE '.$i."\r\n\r\n";
fputs($socket, "DELE $i\r\n");
echo 'Output: '.fgets($socket, 1024).chr(10);
if ($user == "email@email.com")
// $extra = "(list='D' OR list='G') AND email!='' ";
$extra = "(list='D' OR list='Q') AND email!='' ";
else if ($user == "email2@email.com")
// $extra = "list='D' AND email!='' ";
$extra = "(list='A' OR list='Q') AND email!='' ";
if (preg_match("/\<(.+)\>/",$sender,$mm))
$email = $mm[1];
$query = mysql_query("SELECT email FROM kontacts WHERE $extra");
while ($mailer = mysql_fetch_array($query)){
print "This is your email link({$mailer['email']})\n";
// print "This is your email link" $email\n";
// $dis= "This is your email link({$mailer['email']})\n";
// $mail= $mailer['email'];
// print "This is your email link({<a herf=mailto:$mailer['email']Link</a>})\n";
// $message="<a href=mailto:www.ExtremeMusicGroup.com?id=$login target=_blank>CLICK HERE</a>";
//$path_parts = pathinfo('www.google.com');
// echo $url;
// mail($message, $mailer['email'], '[AustinNupes] '.$subject, "From: {$row['firstname']} {$row['lastname']} <$email>\r\nReply-To: AustinNupes <$user>\r\n$headers",$email);
//////mail('[AustinNupes] '.$subject, $message,'[http://www.extremeMusicGroup]'.$mailer['email'], "From: {$row['firstname']} {$row['lastname']} <$email>\r\nReply-To: AustinNupes <$user>\r\n$headers",$email);
//// mail( $subject, $message,'[http://www.extremeMusicGroup]'.$mailer['email'], "From: {$row['firstname']} {$row['lastname']} <$email>\r\nReply-To: AustinNupes <$user>\r\n$headers",$email);
//$message1='[http://www.ExtremeMusicGroup]'.$mailer['email'];
// $message1='[This is your link]'.$sender;
//$message1='[http://www.ExtremeMusicGroup]'.$row['email'];
/*function get_loginemail($login) {
// include ("support/emailheaders.php");
global $headers, $subject;
$res = array();
$res['headers'] = $headers;
$res['subject'] = $subject;
$res['message'] = "<br>
<br>
Thank you for requesting your custom log in KEY for ExtremeMusicGroup.com!<br>
It logs you into your account. Please log in and click \"Settings\" to set your password.<br>
<br>
<a href=http://ExtremeMusicGroup.com/?id=$login>Simply CLICK HERE to log in</a>.<br><br>
<br>
--<br>
Wishing you Happiness, Joy, and Laughter,<br>
Brant McDowell<br>
ExtremeMusicGroup.com<br>";
return $res;
}
*/
// $loginemail = get_loginemail($login);
// mail($email, "Your Custom Login Address", $loginemail['message'], $loginemail['headers'], "-fbounce@domain.com");
// '["<a href=http://www.extrememusicgroup.com/main.php?id=$login>link</a>"]',
// mail($mailer['email'], '[AustinNupes] '.$subject, $message, "From: {$row['firstname']} {$row['lastname']} <$email>\r\nReply-To: AustinNupes <$user>\r\n$headers ");
/// mail($mailer['email'],'[AustinNupes]'.$subject,$message,'[This is your link]'.$sender);
//include "private/databaseconnect.php";
//include "support/class.rc4crypt.php";
mail($mailer['email'],'[AustinNupes]'.$subject,$message,'["<a href=http://www.33shortcuts.com/EMG/index.php?id=$id_encrypted>link</a>",
This is your link]'.$mailer['email']);
//mail($mailer['email'],'[AustinNupes]'.$subject,$message,'[This is your link]'.$mailer['email']);
////////// mail($mailer['email'],'[AustinNupes]'.$subject,$dis,$message);
// mail("$mailer[email]", "$mailer[subject]", "$mailer[message]", "From: $mailer[from]");
// mail("$email_info[to_email]", "$email_info[subject]", "$email_info[message]", "From: $email_info[from_email]")
//echo "Mail send";
//print " <a href=mailto:email@server.net>This is your email account</a><br><br>";
//echo $loginaddress;
}
$i++;
}
echo 'Ending'.chr(10);
fputs($socket, "QUIT\r\n");
}
function parseData($data){
global $subject,$sender,$message,$headers;
$parts = explode(chr(10), $data);
$ismessage = 0;
for ($i=0; $i<count($parts); $i++){
if (substr($parts[$i], 0, 5) == "From:" && !$sender){
$sender = trim(substr($parts[$i], 6));
continue;
}
if (substr($parts[$i], 0, 8) == "Subject:" && !$subject){
$subject = trim(substr($parts[$i], 8));
continue;
}
if (substr($parts[$i], 0, 13) == "Content-Type:" && $ismessage==0){
$headers = $parts[$i] . "\n";
continue;
}
if (strstr($parts[$i],"boundary=") && $ismessage==0){
$headers .= $parts[$i] . "\n";
continue;
}
/* if (substr($parts[$i], 0, 20) == "Content-Disposition:"){
$message = '';
$cd = true;
continue;
}
if (substr($parts[$i], 0, 12) == "------=_Part" && $cd)
break; */
if ($ismessage)
$message .= $parts[$i];
if ($parts[$i] == '' || $parts[$i] == "\r")
$ismessage++;
}
}
?>