Saturday, March 26, 2011

Send mail in Drupal 7 & Drupal 6

<?php

function example_notify($accounts) {
$language = language_default();
$params = array();
$from ="admin@testsite.com"
('example', 'notice','kumarit84@gmail.com',$language ,$params,$from);
}

function example_mail($key, &$message, $params) {
$data['user'] = $params['account'];
$options['language'] = $message['language'];
user_mail_tokens($variables, $data, $options);
switch($key) {
case 'notice':
$langcode = $message['language']->language;
$message['subject'] = t('Notification from !site', $variables, array('langcode' => $langcode));
// Make emails HTML friendly
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
$message['body'][] = t("Dear !username\n\nThere is new content available on the site.", $variables, array('langcode' => $langcode));
break;
}
}

?>

No comments:

Post a Comment