I want to send mails using drupal_mail function but somehow it is sending mail only to To and that to without message body. Below is the code which I am using.
$params = array(
'body' => 'plain text mail',
'subject' => 'Join this Event',
);
if(drupal_mail('join_this_event', 'some_mail_key', "[email protected]", language_default(), $params, "[email protected]", TRUE)){
echo "mail sent";
}
else echo "unable to send";
Below is the hook_mail function of the module
function join_this_event_mail($key,&$message,$params) {
$language = $message['language'];
switch ($key) {
case 'send_link':
$message['subject']=t($params['subject'], $var, $language->language);
$message['body']=$params['body'];
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
$message['headers'] += $params['headers'];
break;
}
}
How can this be resolved? and why is this happening