SMTP Script
Posted: Wed May 17, 2006 10:55 am
Hey,
I've done a SMTP script and this is it:
But i get an error:
Notice: Undefined variable: epost in D:\www\Apeal\mail\david\mail_send.php on line 36
And i don't even have any thing with epost on line 36. So if someone can find the error i'll apreciate it
I've done a SMTP script and this is it:
Code: Select all
<?
error_reporting(E_ALL);
include "../conn.php";
require("D:\www\Apeal\mail\david\phpmailer\class.phpmailer.php");
ini_set("max_execution_time","9999");
ignore_user_abort(true);
#################
# VARIABLAR #
#################
$text = $_POST['meddelande'];
$subject = $_POST['subject'];
$sender = $_POST['sender'];
$user = $_POST['user'];
$datum = $_POST['datum'];
$tid = $_POST['tid'];
$NewReplyTo = $_POST['sender'];
$avser = 'skarpt';
$databas_arkiv = "test_arkiv";
$databas_epost = "test_mailadresser";
##################
# /VARIABLAR #
##################
if($text!=""){
$sql = "SELECT epost FROM $databas_epost WHERE aktiv='yes'";
$result = mysql_query($sql) OR DIE(mysql_error());
$rows = mysql_num_rows($result); //Hur många aktiva subscribers |Borg
// -- nollställning av räknare och innehållsvariabler
$count = 0;
$fails = 0;
$recepient = "";
$message2 = "<a href=\"http://www.websitensnamn.net/tabort.php?id={$epost}?databas={$databas_epost}\">Vill du inte längre få detta nyhetsbrev. Klicka här</a>\r\n";// ..something
// Nu loopar vi ut alla fjån
while ($row = mysql_fetch_array($result)){
$recepient=$row['epost'];
$mail = new PHPMailer(); //Run the class once
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "127.0.0.1"; // SMTP server 127.0.0.1/localhost
$mail->IsHTML(true);
$mail->From = "$sender"; //From whom
$mail->AddAddress('$recepient'); //To whom
$mail->Subject = "$subject"; //Subject
$mail->Body = $text."\n". $message2;//The <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>
$count++; //For our summery (Count ALL mails)
if($mail->Send()) //Is the mail sent or not?
{
$check ='Ja'; //What is that variable for?
}
else
{
$check = 'Nej'; //What is that variable for?
$fails++; //For our summery (Count ALL failed mails)
}
}
echo "<table width=\"924\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" background=\"img/hem_bak.gif\">
<tr>
<td width=\"40\"> </td>
<td width=\"876\"><font face=\"Verdana\" size=\"1\"><br><br><b>Nu är vi klara!<br>Totalt ".$fails." utav ".$count."mail misslyckades, resten har hittat hem till sin nya ägare.<br></b></font></td>
<td> </td>
</tr>
<tr>
<td colspan=\"3\"><img src=\"img/ner.gif\" width=\"924\" height=\"31\" alt=\"hem_ner\" /></td>
</tr>
</table>";
}
?>Notice: Undefined variable: epost in D:\www\Apeal\mail\david\mail_send.php on line 36
And i don't even have any thing with epost on line 36. So if someone can find the error i'll apreciate it