If you are sending this emails from the same email account as the destination it is posible that the email is in your spam folder.
This is because your mail client does not recognize as their own.
Solution: check emails from the main account as not spam.
$my_module = 'foo';
$my_mail_token = 'bar';
$from = variable_get('system_mail', '[email protected]'); // Fill your administrator mail here!
$message = array(
'id' => $my_module . '_' . $my_mail_token,
'to' => $from, // the same email account!
'subject' => 'TEST EMAIL',
'body' => array('test'),
'headers' => array(
'From' => $from,
'Sender' => $from,
'Return-Path' => $from,
),
);
$system = drupal_mail_system($my_module, $my_mail_token);
// The format function must be called before calling the mail function.
$message = $system->format($message);
if ($system->mail($message)) {
// Success.
}
else {
// Failure.
}
Database Logging
module and check Log Messages.