PHP发送邮件功能

I don't understand why my send mail function has stopped working. It used to work ok, but I've just discovered that users who try to sign up to my website no longer receive an email.

I must have changed something by accident.

I've stripped out all of the details to try and get back to basics and work out the problem. But the below code - with correct email addresses replaced - still doesn't work. It always prints that it has succeeded, but emails do not get sent to the address.

Grateful for your help!

$email_address2 = "my@email.com";
    $header2 = "From: webmaster@domain.org.uk
";

    $subject2 = "Your Membership!";
    $message2 = "
    The message2
    ";

$mailsend = mail($email_address2, $subject2, $message2, $header2.">
X-Mailer: PHP/" . phpversion());

if($mailsend) {
    echo 'Your membership information has been mailed to your email address!<br/><br/>Please check it and follow the directions!';
} else {
print "There has been an error. Please try again";
}

The first step would be to figure out where sendmail is installed. Once you know that path, go into your php.ini. You are looking for the sendmail_path setting. Set it appropriately.

If the path is set correctly, the result from a proper call to mail() should return true. (Note that the return value only lets you know if the message was passed on to sendmail [or SMTP in the case of Windows]. It does not guarantee that the e-mail went out, or that sendmail is configured correctly.) If it is returning true and you still aren't getting e-mail, then check your sendmail configuration.