desjardins2010 Posted March 14, 2014 Share Posted March 14, 2014 guys I'm trying to get this script to work and thus far whats happening is 1) when I hit send I get flooded with Quote This message was created automatically by mail delivery software.A message that you sent could not be delivered to one or more of itsrecipients. This is a permanent error. The following address(es) failed: REMOVED@gmail.com SMTP error from remote mail server after end of data: host gmail-smtp-in.l.google.com [173.194.68.27]: 550-5.7.1 [192.196.156.24 11] Our system has detected that this message is 550-5.7.1 not RFC 2822 compliant. To reduce the amount of spam sent to Gmail, 550-5.7.1 this message has been blocked. Please review 550 5.7.1 RFC 2822 specifications for more information. v2si3915203qaf.102 - gsmtp------ This is a copy of the message, including all the headers. ------Return-path: <nobody@host.REMOVED.com>Received: from nobody by host.REMOVED.com with local (Exim 4.82) (envelope-from <nobody@host.REMOVED.com>) id 1WOX41-0002iv-G1; Fri, 14 Mar 2014 14:42:37 -0400To: REMOVED@gmail.comSubject: Reminder From ReferralCatchX-PHP-Script: www.REMOVED.com/admin/pages/mass_mail.php for 64.228.153.209MIME-Version: 1.0Content-type: text/html; charset=iso-8859-1To: desjardins2@REMOVED.comFrom: admin@REMOVED.comTo: USERSEMAIL@gmail.comFrom: admin@REMOVED.comMessage-Id: <E1WOX41-0002iv-G1@host.REMOVED.com>Date: Fri, 14 Mar 2014 14:42:37 -0400 the script I'm running is simply looping through the emails found in the members table and instead of sending mail I just echo and it supply all the emails - what am I doing wrong..? <?php //MASS MAILER FOR REFERRALCATCH.COM //CODE CREATED MARCH 14th 2014 //DESJARDINS MEDIA INC // INCLUDE CONNECT FILE include '../inc/connect.php'; //****************IF FORM WAS SUBMITTED LETS LISTEN FOR THAT************// if ($_SERVER['REQUEST_METHOD'] === 'POST') { //if the post is active lets make sure that all the fields were filled in if (!isset($_POST['subject']) || !isset($_POST['message'])) { //then all fields were not set and must show an error $errors[] = "Sorry you must enter both fields"; //END if (!isset) }else { //both fields were set now we have to clean them up a bit $subject = trim(htmlspecialchars($_POST['subject'])); $message = trim(htmlspecialchars($_POST['message'])); $message = wordwrap($message, 70, "\r\n"); // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Mail it loop through members $grab_emails = "SELECT * FROM `members` WHERE `Activation` = 'NULL'"; $ex_grab = $con -> query($grab_emails); while ($row = $ex_grab -> fetch_assoc()) { $email = $row['Email']; $to = $email; $headers .= 'To: '.$email . "\r\n"; $headers .= 'From: admin@REMOVED.com' . "\r\n"; //send the mail $send = mail($to, $subject, $message, $headers); if ($send) { echo "<font size='6' color='Green'>.</font>"; }else { echo "<font size='6' color='red'>.</font>"; } } //end $_SERVER['REQUEST_METHOD'] } } //****************FIND NUMBER OF VALID EMAILS TO SEND TO ****************// $query_avail = "SELECT * FROM `members` WHERE `Activation` = 'NULL'"; $ex_query = $con -> query($query_avail); $ex_count = $ex_query -> num_rows; /****************** END MEMBER COUNT ***********************************/ ?> <!-- FORM FEILDS FOR EMAIL MESSAGE CREATION--> <table> <div class="member_count">There are currently <?php echo $ex_count; ?> users that can be sent emails.</div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td>Subject:</td><td><input size="36" ="" type="text" name="subject"></td> </tr> <tr> <td valign="top">Message:</td><td><textarea cols="60" rows="10" name="message"></textarea></td> </tr> <tr> <td></td><td><input type="submit" name="submit" value="Process"></td> </tr> </form> </table> Link to comment https://forums.phpfreaks.com/topic/286972-mass-mailer-using-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.