Tuesday, August 16, 2011

How to send email notification to the user email?

Here is the important line :

_user_mail_notify('register_no_approval_required', $account);

@"register_no_approval_required'" is the email template id.

@$account is the drupal user object.

if (user_load(array('mail' => $form['#post']['submitted']['email'])) == FALSE) {

$newUser = array(
'name' => $form['#post']['submitted']['name'],
'pass' => $form['#post']['submitted']['pass'], //user_password(),

// note: do not md5 the password
'mail' => $form['#post']['submitted']['email'],
'status' => 1,
'init' => $form['#post']['submitted']['email'],
'roles'
'roles' => array('4' => 'school')
);
$account = user_save(null, $newUser);
_user_mail_notify('register_no_approval_required', $account);
}

No comments:

Post a Comment