Page 1 of 1

PHP mail() problems

Posted: Fri Aug 07, 2009 12:42 pm
by hwmetzger
Hey, me again with another newbie question.

For some reason this isn't working:

Code: Select all

 
function mail_to($value)
{
    
    $email = $value['mail'];
    $subject = 'Account Registration';
    $message = "Your Username is: ".$value['username'];
    $headers = 'From: place@stuff.com' . "\r\n" .
    'Reply-To: place@stuff.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
 
            if (mail($email, $subject, $message, $headers)) 
            { 
            echo "User information successfully sent to ".$email.""; 
            }
            else 
            { 
            echo "Email undeliverable.";
            }
}
 
The $value that I am passing to the fuction is an array with elements like username, password, email and so on. For some reason no matter what I try, it always does the Else branch of my if statement.

Re: PHP mail() problems

Posted: Fri Aug 07, 2009 9:29 pm
by aceconcepts
Have you tried checking the value of your variables to see if they exist?