Mohammad Aghayari Mohammad Aghayari - 6 months ago 10
PHP Question

sending email on php

I have this code to send email.and I got no error in sending email.

if(mailSender()){
echo 'meiled.';
}else {
die('not sent');
}
function mailSender() {
$to = 'info@fcrop.com';
$subject = 'An Abstract Submitted';
$message = 'An Abstract Submitted Recently In ICNBA.org';
$headers = 'Frominfo@icnba.org';
mail($to, $subject, $message, $headers);
}


it does not send email.

Fin Fin
Answer

Because the if expression evaluates a boolean, and mailSender() returns none.

Add this to your function:

return mail($to, $subject, $message, $headers);

For more information about see the php documentation: http://php.net/manual/en/control-structures.if.php

Comments