Jump to content

Liam-a-

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Liam-a-

  1. Line 83: if (mail($emails[$i], $_POST['subject'], $msg, "From: Your Site<newsletter@yoursite.com>")) Line 87: echo "Mail $i failed<br>To: ".$emails[$i].'<br>'; New error PHP Notice: Undefined offset: 3 in Email.php on line 83 PHP Warning: mail(): SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in Email.php on line 83 PHP Notice: Undefined offset: 3 in Email.php on line 87 Don't no what these errors mean
  2. Can anyone help? am getting a error its about Function mail() PHP Warning: mail(): SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in Line 30: mail($emails[$i], $_POST['subject'], $msg, "From: Your Site<newsletter@yoursite.com>"); Now when ive been on the php website people say mail is the correct function to use, now my windows server rejects this.. can anyone help me out with a function that will send mail and also work on windows server. Thanks
  3. Line 30: mail($emails[$i], $_POST['subject'], $msg, "From: Your Site<newsletter@yoursite.com>");
  4. Ive found a new error on Line 30. PHP Warning: mail(): SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in
  5. Just alot of sites when they send out there spam mail it comes to inbox :/ not spam
  6. Also is there a PHP Email header you can add so it wont go to SPAM box?
  7. Hello, I currently have this script, its sending emails perfect but am getting a Error-500: Internal server error. after i press the submit button. its strange how i get this error but the mail still sends, ive tried for days to stop the error can anyone on here help me get rid of the error and help me to be able to send this message in HTML as I want to add images. well i would like to create the HTML email body within the code if anyone can point me in the right direction please. <?php //db connection mysql_connect($db_host,$db_username,$db_password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); if(isset($_POST['submit'])) { //set emails as array $emails = array(); $x = 1; //quantity of emails sent before 3 sec delay to avoid timeout $hold = 99; //query to select the email address $sql = mysql_query("SELECT email_address FROM tblusers") or die(mysql_error()); //fetch them while($r = mysql_fetch_array($sql)) { $emails[] = $r['email']; } //count total emails $total = count($emails); //repeat for each email for ($i = 1; $i <= $total; $i++) { //stripslashes in message $msg = stripslashes($_POST['msg']); //send email to user (need to change name and email:) mail($emails[$i], $_POST['subject'], $msg, "From: Your Site<newsletter@yoursite.com>"); //if $x = 10 then wait 3 seconds to avoid timeout $x++; if($x == $hold) { sleep(3); $x = 0; } } //close database connection and echo success message mysql_close(); echo "<strong>Mail successfully sent to $total addresses!</strong><br><br>"; } ?> <html> <head> <title>Send Mail</title> <body> <form name="mail" action="" method="post"> Subject: <input type="text" name="subject" size="40"><br> <textarea name="msg" cols="40" rows="8"></textarea><br> <input type="submit" name="submit" value="Send Email"> </form> </body> </html> Thanks
  8. Theres a funny thing with this code, i press submit and it goes straight to error 500 but still send out ALL emails . so if its only going to be me using this script im not fussed if it returns to a error page after but still does the job. Thanks.
  9. Already had that in still giving error 500
  10. When i press submit it gives me Error 500
  11. even putting this in "" still gives me a error and no emails sent
  12. mail($emails[$i], $subject, $msg, "From: Your Site<newsletter@yoursite.com>"); This line I changed $emails[$i] to my email, and it sent me emails fine, can anyone help me why this "$emails[$i]" is causing a 500 error. Thanks
  13. when i submit nothing happens, doesnt tell me how many are sent just click and refreshes page basicly
  14. Can anyone tell me what is wrong with this script? <?php //db connection mysql_connect($db_host,$db_username,$db_password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); if ($submit) { //set emails as array $emails = array(); $x = 1; //quantity of emails sent before 3 sec delay to avoid timeout $hold = 99; //query to select the email address $sql = mysql_query("SELECT email_address FROM tblusers") or die(mysql_error()); //fetch them while($r = mysql_fetch_array($sql)) { $emails[] = $r['email']; } //count total emails $total = count($emails); //repeat for each email for ($i = 1; $i <= $total; $i++) { //stripslashes in message $msg = stripslashes($msg); //send email to user (need to change name and email:) mail($emails[$i], $subject, $msg, "From: Your Site<newsletter@yoursite.com>"); //if $x = 10 then wait 3 seconds to avoid timeout $x++; if($x == $hold) { sleep(3); $x = 0; } } //close database connection and echo success message mysql_close(); echo "<strong>Mail successfully sent to $total addresses!</strong><br><br>"; } ?> <html> <head> <title>Send Mail</title> <body> <form name="mail" action="<? echo $PHP_SELF; ?>" method="post"> Subject: <input type="text" name="subject" size="40"><br> <textarea name="msg" cols="40" rows="8"></textarea><br> <input type="submit" name="submit" value="Send Email"> </form> </body> </html>
  15. I have been through my debug process on my server, currently cant get access to that code due to not been at home... i followed all of the steps that i was shown and it still didnt work.. i removed the things that i did not need like suggested. it only sends to last email in server not the loop.
  16. No difference, when i tried the changes they made errors or ither i entered it wrong. ive tried for days to get this working.
  17. <?php session_start(); //allow sessions include("config.php"); //get database information if(!$_POST[send]){ //if the form was not submitted echo "<form action='' method='post' > <table width='600' border='0' cellspacing='0' cellpadding='0' align='left'> <tr> <td height='35' colspan='2' align='left'><b>Send a email to all users</b></td> </tr> <tr> <td height='35' align='left'><b>Subject:</b></td> <td width='515' align='left'><input type='text' name='title' id='title' size='30' /></td> </tr> <tr> <td width='85' height='150' align='left' valign='top'><b>Message:</b></td> <td align='left' valign='top'><textarea name='msg' id='msg' cols='65' rows='9'></textarea></td> </tr> <tr> <td height='35'> </td> <td><input type='submit' name='send' id='send' value='Send' /></td> </tr> </table> </form>"; //return with the form }else{ //or if it was $supportEmail = 'support@mysite.com'; $title = strip_tags(htmlspecialchars($_POST[title])); $date = date("F j, Y, g:i a"); $values = array(); $message = stripslashes($_POST[msg]); //message $getusers = mysql_query("SELECT * FROM user"); $getemail = "SELECT email FROM user"; $result = mysql_query($getemail); $to=$row['email']; $link="<a href=\"http://mysite.com/contact.php\">Click here</a>"; if(empty($message)){ echo "<a href=\"history.go(-1)\">Go Back</a>You Can Not Send An Empty Message!"; }else{ while ($row = mysql_fetch_array($result)){ $email = $row['email']; //send email } $body = <<<EOD <br><hr><br> =============================== <br> <br> Subject: $title <br> Message: $message <br><br> This message has been sent by My Site. Do not reply to this email. $link to contact support. <br> =============================== <br><br> EOD; $headers = "From: $supportEmail\r\n"; $headers .= "Content-type: text/html\r\n"; $send_contact = mail($email,$title,$body,$headers); // Check, if message sent to your email if($send_contact){ echo "<script language='javascript'> alert('Your site wide email has been sent.'); window.location.href = 'http://mysite.com/x9y6uw5e8_/admin_panel.php?page=mass_email'; </script>"; } } //end check for empty message } //end form check ?>
  18. used from the following help, im really stuck wish it would work
  19. Still having problems it will not send out any emails
  20. So can you help me reconstruct my code?, because ive tried the changes and its not worked
  21. this is my code that i have, could anyone help me. its not sending to any email that is stored in my database <?php session_start(); //allow sessions include("config.php"); //get database information if(!$_POST[send]){ //if the form was not submitted echo "<form action='' method='post' > <table width='600' border='0' cellspacing='0' cellpadding='0' align='left'> <tr> <td height='35' colspan='2' align='left'><b>Send a email to all users</b></td> </tr> <tr> <td height='35' align='left'><b>Subject:</b></td> <td width='515' align='left'><input type='text' name='title' id='title' size='30' /></td> </tr> <tr> <td width='85' height='150' align='left' valign='top'><b>Message:</b></td> <td align='left' valign='top'><textarea name='msg' id='msg' cols='65' rows='9'></textarea></td> </tr> <tr> <td height='35'> </td> <td><input type='submit' name='send' id='send' value='Send' /></td> </tr> </table> </form>"; //return with the form }else{ //or if it was $supportEmail = 'support@mysite.com'; $title = strip_tags(htmlspecialchars($_POST[title])); $date = date("F j, Y, g:i a"); $values = array(); $message = stripslashes($_POST[msg]); //message $getusers = mysql_query("SELECT * FROM user"); $getemail = "SELECT email FROM user"; $result = mysql_query($getemail); $to=$row['email']; $link="<a href=\"http://mysite.com/contact.php\">Click here</a>"; if(empty($message)){ echo "<a href=\"history.go(-1)\">Go Back</a>You Can Not Send An Empty Message!"; }else{ while ($row = mysql_fetch_array($result)){ $email = $row['email']; //send email } $body = <<<EOD <br><hr><br> =============================== <br> <br> Subject: $title <br> Message: $message <br><br> This message has been sent by My Site. Do not reply to this email. $link to contact support. <br> =============================== <br><br> EOD; $headers = "From: $supportEmail\r\n"; $headers .= "Content-type: text/html\r\n"; $send_contact = mail($email,$title,$body,$headers); // Check, if message sent to your email if($send_contact){ echo "<script language='javascript'> alert('Your site wide email has been sent.'); window.location.href = 'http://mysite.com/x9y6uw5e8_/admin_panel.php?page=mass_email'; </script>"; } } //end check for empty message } //end form check ?>
  22. i wont to select a list of records from a db tables named 'comment' i only want it to have 5 per page and i want somethng like this at the bottom o the page Page: 1 2 3 4 5 Is that possible??
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.