twilitegxa Posted August 24, 2008 Share Posted August 24, 2008 I have a mailing list script, but keep receiving the error: 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:\wamp\www\files\sendmymail.php on line 46 Can anyone help me configure this properly? Here is also my code, in case line 46 is the problem: <?php if ($_POST[op] != "send") { //haven't seen the form, so show it print " <HTML> <HEAD> <TITLE>Send A Newsletter</TITLE> </HEAD> <BODY> <h1>Send A Newsletter</h1> <form method=\"post\" action=\"$_SERVER[php_SELF]\"> <p><strong>Subject:</strong><br /> <input type=\"text\" name=\"subject\" size=30></p> <p><strong>Mail Body:</strong><br /> <textarea name=\"message\" cols=50 rows=10 wrap=virtual></textarea> <input type=\"hidden\" name=\"op\" value=\"send\"> <p><input type=\"submit\" name=\"submit\" value=\"Send It\"></p> </form> </body> </html>"; } else if ($_POST[op] == "send") { //want to send form; so check for required fields if (($_POST[subject] =="") || ($_POST[message] == "")) { header("Location: sendmymail.php"); exit; } //connect to database $conn = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("smrpg",$conn) or doe(mysql_error()); //get emails from subscribers list $sql = "select email from subscribers"; $result = mysql_query($sql,$conn) or die(mysql_error()); //create a From: mailheader $headers = "From: Your Mailing List <twilitegxa@aol.com\n"; //loop through results and send mail while ($row = mysql_fetch_array($result)) { set_time_limit(0); $email = $row['email']; mail("email", stripslashes($_POST[subject]), stripslashes($_POST[message]), $headers); print "newsletter sent to $email<br />"; } } ?> Link to comment https://forums.phpfreaks.com/topic/121114-anyone-have-experience-with-wampserver-and-mailing-list-script/ Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 dont double post. http://www.phpfreaks.com/forums/index.php/topic,213402.0.html Link to comment https://forums.phpfreaks.com/topic/121114-anyone-have-experience-with-wampserver-and-mailing-list-script/#findComment-624368 Share on other sites More sharing options...
twilitegxa Posted August 24, 2008 Author Share Posted August 24, 2008 Sorry, i was trying to change the title, hoping someonw withWampServer expereince could help. I don't know how to close topics, if it can even be done by the topic poster. Link to comment https://forums.phpfreaks.com/topic/121114-anyone-have-experience-with-wampserver-and-mailing-list-script/#findComment-624372 Share on other sites More sharing options...
Recommended Posts