Lori De Posted February 25, 2009 Share Posted February 25, 2009 I'm struggling with my php code. I keep getting a "Parse error: syntax error, unexpected '[' in C:\inetpub\wwwroot\test1.php on line 29" I'm new to PHP and I really appreciate any help I can get. Here's my code: #!/usr/local/bin/php4 <?php include('Mail.php'); /* mail setup recipients, subject etc */ $headers["from"] = "emailaddress"; $headers["to"] = "[email protected]"; $headers["subject"] = "test"; $mailmsg = "$to, $subject, $body, $headers"; /* SMTP server name, port, user/passwd */ $smtpinfo["host"] = "https://mail.oursite.com"; $smtpinfo["port"] = "25"; $smtpinfo["auth"] = true; $smtpinfo["username"] = "mylogin"; $smtpinfo["password"] = "mypassordi"; $mailmsg = "test"; /* Create the mail object using the Mail::factory method */ $mailto ['$smtp, $smtpinfo']; /* Ok send mail */ $mail_object = send ['$to, $from, $headers, $mailmsg']; /*Client Variables*/ $subject = $_REQUEST['test']; $webMaster =$_REQUEST['myemail@address']; /*Gathering Data Variables*/ $projectnameField = $_POST['projectname']; $ProjectownerField = $_POST['Projectowner']; $emailaddressField = $_POST['emailaddress']; $locationField = $_POST['location']; $completebyField = $_POST['completeby']; $dateField = $_POST['date']; $body = <<<EOD <br><hr><br> Project: $projectname <br> Owner: $Projectowner <br> Email: $emailaddress <br> Location: $location <br> Completed By: $completeby <br> Date: $date <br> EOD; /* Results rendered as HTML */ $theResults = <<<EOD <!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=UTF-8" /> <title>Voice Of Client</title> </head> <body> Your survey has been submitted. Thank you. </body> </html> EOD; echo "$theResults"; ?> Link to comment https://forums.phpfreaks.com/topic/146881-php-mailform-wont-send/ Share on other sites More sharing options...
supermerc Posted February 25, 2009 Share Posted February 25, 2009 Are you sure your host allows mail function? Many free hosts dont. Link to comment https://forums.phpfreaks.com/topic/146881-php-mailform-wont-send/#findComment-771154 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.