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 Link to comment https://forums.phpfreaks.com/topic/111508-newsletter-scriptmail-function-not-working/ 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. Link to comment https://forums.phpfreaks.com/topic/111508-newsletter-scriptmail-function-not-working/#findComment-572280 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 Link to comment https://forums.phpfreaks.com/topic/111508-newsletter-scriptmail-function-not-working/#findComment-572309 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. Link to comment https://forums.phpfreaks.com/topic/111508-newsletter-scriptmail-function-not-working/#findComment-572337 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? Link to comment https://forums.phpfreaks.com/topic/111508-newsletter-scriptmail-function-not-working/#findComment-572349 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) Link to comment https://forums.phpfreaks.com/topic/111508-newsletter-scriptmail-function-not-working/#findComment-572353 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. Link to comment https://forums.phpfreaks.com/topic/111508-newsletter-scriptmail-function-not-working/#findComment-572380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.