atticus Posted July 24, 2008 Share Posted July 24, 2008 This script generates an email when a user registers (there is not db connection). I am getting an error and I am not sure what it means. Error: Notice: Undefined variable: headers in /var/www/../confirm.php on line 43 Notice: Use of undefined constant sendmail_from - assumed 'sendmail_from' in /var/www/..project/confirm.php on line 45 Notice: Use of undefined constant sendmail_from - assumed 'sendmail_from' in /var/www/../confirm.php on line 47 Notice: Use of undefined constant sendmail_from - assumed 'sendmail_from' in /var/www/..confirm.php on line 50 Notice: Use of undefined constant sendmail_from - assumed 'sendmail_from' in /var/www/..confirm.php on line 52 <?php foreach ($_POST as $key => $val) { $_POST[$key] = stripslashes($val); } $to = "an email address"; // me $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $password = $_POST['password']; $subject2 = "A new FTP Account Registration!"; email body... $headers .= "From: " . $name . "<" . $email . ">\r\n"; ini_set(sendmail_from, $email); mail($to, $subject2, $msg, $headers); ini_restore(sendmail_from); $to2 = 'email address 2'; ini_set(sendmail_from, $email); mail($to2, $subject2, $msg, $headers); ini_restore(sendmail_from); Thanks in advance! Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 24, 2008 Share Posted July 24, 2008 Put quotes around sendmail_from in the ini_set and ini_restore calls. Quote Link to comment Share on other sites More sharing options...
atticus Posted July 24, 2008 Author Share Posted July 24, 2008 thanks! I am still getting an error for this line of code: $headers .= "From: " . $name . "<" . $email . ">\r\n"; Quote Link to comment Share on other sites More sharing options...
Jabop Posted July 24, 2008 Share Posted July 24, 2008 thanks! I am still getting an error for this line of code: $headers .= "From: " . $name . "<" . $email . ">\r\n"; It must be in the previous lines that you didn't paste, cause that shows no errors. Quote Link to comment Share on other sites More sharing options...
atticus Posted July 24, 2008 Author Share Posted July 24, 2008 Original: $headers .= "From: " . $name . "<" . $email . ">\r\n"; Fixed: $headers = "From: " . $name . "<" . $email . ">\r\n"; I removed the period before the "=" Thanks for all your help! Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.