Jump to content

Newsletter script,mail function not working


TheFreak

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.