Richlather Posted December 15, 2009 Share Posted December 15, 2009 Hi- I've got a site with I'm attempting to add a mailing list feature to. It's hosted from an outside server with one of the major hosting companies. I've constructed a database to hold only two fields, name and email address. The html form and php add file document work great. But when I attempted to add code to send an auto-reply email to a visitor who signs up for the mailing list, no return "welcome" email is generated. I'm hoping someone can point out where I've gone wrong (and hopefully how to fix it). Thanks in advance for any help you can provide. Here's the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <meta http-equiv="REFRESH" content="0; URL=http://www.mywebsite/thanks.htm" /> </head> <body> <?php $Name=$_POST['Name']; $EMail=$_POST['EMail']; $connection=mysql_connect ("database location", "database name", "password") or die ('I cannot connect to the database.'); mysql_select_db ("database name",$connection) or die( "Unable to select database"); $query = "INSERT INTO `table name` (`ID`, `Name`, `EMail`) VALUES ('', '$Name', '$EMail')"; mysql_query($query); mysql_close(); $to = $EMail; $from = "my email address"; $headers = "FROM:".$from."\r\n"; $headers .= "Reply-To:".$from."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $return_path = $from; $subject = "subject here"; $message = "Hi ". $Name; $message .= "<br>Thank you for subscribing to the our mailing list. You'll soon be receiving fast breaking news as well as special events and more. To change your subscription: If you'd like your email updated or changed for any reason, please advise us and we will be happy to oblige. Or, if you no longer wish to receive e-mail updates from us, you can unsubscribe by returning any email update with the subject line \"unsubscribe\"."; mail($to,$subject,$message,$headers,"-f".$return_path); ?> </body> </html> Thanks again. Rich Link to comment https://forums.phpfreaks.com/topic/185169-help-with-auto-response-code/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.