Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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

share|improve this question
Can you post your join_this_event_some_mail_key() function? Documentation says that's what will be called to generate your message's body. – Mołot May 22 at 7:41
Hi Malot. Added the function in question. It is now sending the mail to cc and bcc but still mail body is empty. – antnewbee May 22 at 9:10
If you will not show function's code, we will not be able to tell you what's wrong with her code. – Mołot May 22 at 9:15
Hi Malot. I have not implemented _key() function. Is it necessary to implement? If yes how can I implement it. – antnewbee May 22 at 10:07
I linked docs in my first comment. This is not free code writing service. Read the docs, try, ask specific question about specific problem. – Mołot May 22 at 10:08
show 4 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.