Using mail()

Status
Not open for further replies.

kdl201089

New Member
Messages
4
Reaction score
0
Points
0
Hello,

I make use of the mail function on my site. But when i want to mail, i don't receive anything. How to solve this?
 

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
Please show us the script/form involved. The mail system did have a recent problem due to spammers clogging the system, but it is working now.
 

kdl201089

New Member
Messages
4
Reaction score
0
Points
0
PHP:
<?php

/**
 * @author Kevin de Leeuw
 * @copyright 2010
 */

function mailouders() {
    $leerling = "Kevin de Leeuw";
    $to = "kdl2010@live.nl";
    $subject = "Kind absent";
    $message = "Uw kind ".$leerling." is absent gemeld op ".date("j F, Y, H:i ")."";
    
    mail($to, $subject, $message);
}


$state=$_POST['status'];
foreach ($state as $statename);

if($statename == "absent") {
    mailouders();
}

echo "Presentielijst verzonden";



?>
 

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
PHP:
<?php

/**
 * @author Kevin de Leeuw
 * @copyright 2010
 */

function mailouders() {
    // ADJUST TO AN ACCOUNT THAT YOU HAVE ON YOUR DOMAIN
    $headers = 'From: kevin@kdl2010.x10.mx' . "\r\n" .
    'Reply-To: kevin@kdl2010.x10.mx' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();


    $leerling = "Kevin de Leeuw";
    $to = "kdl2010@live.nl";
    $subject = "Kind absent";
    $message = "Uw kind ".$leerling." is absent gemeld op ".date("j F, Y, H:i ")."";
    
    mail($to, $subject, $message, $headers); // ADD HEADERS
}


$state=$_POST['status'];
foreach ($state as $statename){  // <--------------

if($statename == "absent") {
    mailouders();
}

}

echo "Presentielijst verzonden";



?>

Try adding the Headers. And, your loop did not include the mailing.
 
Last edited:
Status
Not open for further replies.
Top