$from = $systemAdmin;
$emailTo=$email;
$subject="New";
$body="
hola
";
//to call function for mail()
if(sendMail($emailTo,$subject,$body,$from))
{
return 'fail';
}
else
{
return 'success';
}
function sendMail($sentTo,$subject,$message,$from) // send email function
{
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: $from\r\n";
$headers .= "Bcc: [email protected]\r\n";
$headers .= "Bcc: [email protected]\r\n";
if(is_array($sentTo))
{
foreach($sentTo as $email){ //to add multiple mail in 'To'
mail($email, $subject, $message, $headers);
}
}
else
{
mail($sentTo, $subject, $message, $headers);
}
}