0

I have a custom registration field that i have in my drupal 6 site.Once a user has been registered a mail will be send to the corresponding user with his or her account credentials.I have used drupal_mail function for this purpose.Is there any means by which i could create such a mail through the back-end. I have seen User e-mail settings.Is it possible to implement this mail function through the back-end rather than programatically. Is yes i would be really curious to look up on that.Hope someone might help me with this..

1

You could use the Rules Module for this.

Steps:

  1. Define an Event that whenever a registration is there.

  2. Then Define the Action to send Mail with proper Format.

For more details about the Rules module go through README.txt of this module.

  • tanx for the reply @Nitesh.Rather than using a contributed module,is there any other means...?Can'y i use User e-mail settings for my purpose..??? – Outlooker Aug 7 '13 at 6:41
1

i think you are expecting a place where you can create a email template and then call or use the same template using Rules or code depending on action.

if you want to maintain only less templates then Rules module is the more than sufficient.

or, you have many templates, then PET is the solution, where you can create N number of templates, those templates can be triggered manually or using Rules.

0

Instead of using the Contributed Module you could also go for writing a custom Module ie defining hook_mail() when a particular event go for.

function hook_mail($key, &$message, $params) {
  $account = $params['account'];
  $context = $params['context'];
  $variables = array(
  '%site_name' => variable_get('site_name', 'Drupal'),
  '%username' => format_username($account),
);
if ($context['hook'] == 'taxonomy') {
  $entity = $params['entity'];
  $vocabulary = taxonomy_vocabulary_load($entity->vid);
  $variables += array(
  '%term_name' => $entity->name,
  '%term_description' => $entity->description,
  '%term_id' => $entity->tid,
  '%vocabulary_name' => $vocabulary->name,
  '%vocabulary_description' => $vocabulary->description,
  '%vocabulary_id' => $vocabulary->vid,
 );
}

// Node-based variable translation is only available if we have a node.
if (isset($params['node'])) {
  $node = $params['node'];
  $variables += array(
  '%uid' => $node->uid,
  '%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)),
  '%node_type' => node_type_get_name($node),
  '%title' => $node->title,
  '%teaser' => $node->teaser,
  '%body' => $node->body,
 );
}
$subject = strtr($context['subject'], $variables);
$body = strtr($context['message'], $variables);
$message['subject'] .= str_replace(array("\r", "\n"), '', $subject);
$message['body'][] = drupal_html_to_text($body);
}

For More details go through the link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.