TheFreak Posted June 23, 2008 Share Posted June 23, 2008 Hello guys, I am making a newsletter script,here is my piece of code which sends the newsletter choosing the users from the 3 lists. $mails="SELECT * from list WHERE listid='$lists'"; $mails2=mysql_query($mails) or die("Could not select mails"); while($mails3=mysql_fetch_array($mails2)) { $headers = "From: Kingdom World \r\n"; $headers.= "Content-Type: text/html; charset=ISO-8859-1 "; $headers .= "MIME-Version: 1.0 "; mail("$mails3[address]","$subject","$matter",$headers); } print "Newsletter Sent"; } I have two questions 1.Will this while loop select every email in the database which come under suppose list1 ? 2.When i tested it,i get this error and i didnt recieve my mails PHP Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Documents and Settings\blah\My Documents\MyNewsletter\admin\sendletter.php on line 35 PHP Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Documents and Settings\blah\My Documents\MyNewsletter\admin\sendletter.php on line 35 PHP Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Documents and Settings\blah\My Documents\MyNewsletter\admin\sendletter.php on line 35 Can someone please help me with it? Thankyou Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted June 23, 2008 Share Posted June 23, 2008 You need to contact your hosting provider. That's an issue they should be able to help with. Quote Link to comment Share on other sites More sharing options...
TheFreak Posted June 23, 2008 Author Share Posted June 23, 2008 Oh i see..well am running it on my php editor,ill put is on my server and check Thanks Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted June 23, 2008 Share Posted June 23, 2008 Oh well in that case, you should check your server before posting it as a problem. You didn't say that you weren't using your server to try to email. Quote Link to comment Share on other sites More sharing options...
TheFreak Posted June 23, 2008 Author Share Posted June 23, 2008 Ok sorry But is my while loop correct? Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted June 23, 2008 Share Posted June 23, 2008 It appears to be fine. Test it by commenting out the mail function and doing: echo "$mails3[address]<br>\n"; that way you can see all of the email addresses that would be emailed(provided the mail function works) Quote Link to comment Share on other sites More sharing options...
TheFreak Posted June 23, 2008 Author Share Posted June 23, 2008 Thanks and yes it is getting listed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.