Page 1 of 1

mail() function not working php4

Posted: Tue Feb 10, 2009 3:36 pm
by peterj
Hi,
I have been using the php mail() function for sending simple emails with form posts which has been working great.
I am having issues with the function working on PHP4 though, no error, just a blank page is returned.

My code is as follows:

Code: Select all

public function sendMail(){
 
    $recipient = "me@domain.com";
    $fname = $_POST['fname'];
    $lname = $_POST['lname'];
    $dob = $_POST['dob'];
 
    $question1a = $_POST['question1a'];
    $question1b = $_POST['question1b'];
    $question1c = $_POST['question1c'];
    $question1d = $_POST['question1d'];
    $question1e = $_POST['question1e'];
    $question1f = $_POST['question1f'];
    $question1g = $_POST['question1g'];
    $question1h = $_POST['question1h'];
    $question1i = $_POST['question1i'];
    $question1j = $_POST['question1j'];
 
 
    $subject = "Permit to Work - Assessment results";
 
    $body = "
 
        You have recieved Permit to Work assessment results. \n\n
 
        First Name: \t $fname \n
        Last Name:\t $lname \n
        Date of Birth:\t $dob \n
 
        Employee quiz answers supplied. \n\n
 
        Question 1. What are 2 of the responsibilities for each of the following roles relating to Permit to Work? \n
 
        Plant Manager 1: \t $question1a \n
        Plant Manager 2: \t $question1b \n\n
        Permit Issuer 1: \t $question1c \n
        Permit Issuer 2: \t $question1d \n\n
        Permit Receiver 1: \t $question1e \n
        Permit Receiver 2: \t $question1f \n\n
        Safety Observer 1: \t $question1g \n
        Safety Observer 2: \t $question1h \n\n
        Permit User 1: \t $question1i \n
        Permit User 2: \t $question1j \n\n\n
 
    ";
 
 
    $mailSent = mail($recipient, $subject, $body);
 
 
    if (!$mailSent) {
        header("Location:index.php?id=".$productID."&status= There was an issue sending your results. Sorry");
    } else {
        header("Location:index.php?status=Your assessment has been submitted.");
}
Does anyone know of a good alternative that will work with PHP4?

Thanks in advance.