PHP mail() problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hwmetzger
Forum Commoner
Posts: 25
Joined: Fri Jun 12, 2009 1:11 pm

PHP mail() problems

Post 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.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: PHP mail() problems

Post by aceconcepts »

Have you tried checking the value of your variables to see if they exist?
Post Reply