Jump to content

[SOLVED] Undefined Variables in mail script


atticus

Recommended Posts

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!

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.