grlayouts Posted June 12, 2007 Share Posted June 12, 2007 i have a newletter script.. yes i know another one. but im getting no emails sent the code i have is <?php require("header.php"); ?> <? if (!$action) { ?> <div align="center"> <form action="newsletter.php?action=2" method="post"> <input name="headline" type="text" value="Insert subject here" size="60" maxlength="128" /><br /> <textarea name="newsl" cols="70" rows="20"></textarea><br /> <input type="submit" value="submit" name="go"> </form> When you press submit you'll only see 3 newsletters. Thats should be enough to see if it works. <table width="350" border="0" cellpadding="0" cellspacing="0" bgcolor="#336666"> <tr> <caption>Tags to use in letter.</caption><br /> <td width="25%" align="center">HoboName</td> <td width="75%" align="center">To insert pimp full name</td> </tr> <tr> <td width="25%" align="center">SIGNATURE</td> <td width="75%" align="center">To insert your signature</td> </tr> <tr> <td width="25%" align="center">---</td> <td width="75%" align="center">---</td> </tr> </table> <? } if ($action == "2") { ?> <? $getuser = mysql_query("SELECT id,name,email FROM `players` WHERE 1 limit 3"); while ($users = mysql_fetch_array($getuser)){ if($rankstart==0){$color="#395A7C";$rankstart++;} elseif($rankstart==1){$color="#e97f0d";$rankstart--;} ?> <? $myclass = &New NewsLetter; $letter = ("$newsl"); $pname = ("$users[1]"); $email = ("$users[2]"); $fixletter = $myclass->replacenews($letter); $fixletter_ = ereg_replace("PNAME", "$pname", $fixletter); ?> <table width="350" align="center" border="0" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="<?=$color?>" align="left"><small> <div align="right" style="text-decoration:overline underline">Newsletter send to: <I><?=$users[0]?> - <?=$users[1]?> - <?=$users[2]?></I></div> <div align="center" style="font-size:larger"><? echo ("$headline")?></div><br /> <? echo nl2br("$fixletter_")?> </small></td> </tr> </table> <?}?> <div align="center"> <form action="newsletter.php?action=3" method="post"> <!-- <input name="email" type="hidden" value="<?=$email?>" /> --> <input name="subj" type="hidden" value="<?=$headline?>" /> <input name="enewsletter" type="hidden" value="<?=$fixletter?>" /> <input name="go" type="submit" value="Send the newsletter" /> </form> <b>This is the point of no return.</b><br>When you click "Send the newsletter" its out of your hands untill all mails are send out.<br>If you need to change anything, use your browsers BACK functions. </div> <? } if ($action == "3") { ?> <? #function br2nl( $message ) { # return preg_replace( '!<br.*>!iU', "\n", $message ); #} $getuser = mysql_query("SELECT id,name,email FROM `users` WHERE 1"); while ($users = mysql_fetch_array($getuser)){ $pname = ("$users[1]"); $enewsletter = ereg_replace("PNAME", "$pname", $enewsletter); $email = ("$users[2]"); $subject = ("$subj"); $message = ("$enewsletter"); mailnewsletter("$subject","$message","$email"); function mailnewsletter ($subject, $message, $email){ $MP = "/usr/sbin/sendmail -t"; $fd = popen($MP,"w"); fputs($fd, "To: $email\n"); fputs($fd, "From: PutaNET Newsletter <[email protected]>\n"); fputs($fd, "Subject: $subject\n"); fputs($fd, "X-Mailer: PHP4\n"); fputs($fd, $message); pclose($fd); } class NewsLetter{ function replacenews($somehtml){ $fromowner =("HoboTown Admin Paul McKinney [email protected] http://www.hobotown.co.uk"); $somehtml = ereg_replace("SIGNATURE", "$fromowner", $somehtml); #return nl2br("$somehtml"); return $somehtml; } } }?> <div align="center"><a href="newsletter.php?action=4">Done click here.</a></div> <? } if ($action == "4") { ?> <pre> All mail send out. Congrats your now apart of the spammer world. Muhahahahaha () () ( '.' ) (")_(") </pre> <? } ?> <? sitefooter(); ?> any idea's? Link to comment https://forums.phpfreaks.com/topic/55247-unsent/ Share on other sites More sharing options...
Yesideez Posted June 12, 2007 Share Posted June 12, 2007 Is that newsletter.php? Link to comment https://forums.phpfreaks.com/topic/55247-unsent/#findComment-273071 Share on other sites More sharing options...
Yesideez Posted June 12, 2007 Share Posted June 12, 2007 Just wondering why you're doing this: function mailnewsletter ($subject, $message, $email){ $MP = "/usr/sbin/sendmail -t"; $fd = popen($MP,"w"); fputs($fd, "To: $email\n"); fputs($fd, "From: PutaNET Newsletter <[email protected]>\n"); fputs($fd, "Subject: $subject\n"); fputs($fd, "X-Mailer: PHP4\n"); fputs($fd, $message); pclose($fd); } I'd use this instead: function mailnewsletter($subject,$message,$email) { if (mail($email,$subject,$message,'From: PutaNET Newsletter <[email protected]>\r\n')) { return true; } else { return false; } } That way you can call the function like this: if (mailnewsletter('Subject here','Message here','[email protected]')) { echo 'Mail sent OK'; } else { echo 'Mail failed'; } Link to comment https://forums.phpfreaks.com/topic/55247-unsent/#findComment-273078 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.