Reputation: 7884
When a user signs up at a Drupal site, there is a configurable message that Drupal will send the user letting them know their username and password.
I have about 1,000 users that I imported, but at the time, I didn't want to notify them - but now I do. Is there a way notify the users without reimporting them?
I looked through some of the modules I thought might contain that function, but I couldn't find it??
Upvotes: 6
Views: 636
Reputation: 18475
Of course there is a way: If you want to do this just one time, I recommend using a quick n' easy way... drupal_bootstrap()
. In an external php file call this function to bootstrap Drupal, then load users and dispatch email messages. Here's a pseudo-code:
<?php
// ...
// Change directory to Drupal root
chdir(../../);
// Bootstrap Drupal
require './includes/bootstrap.inc';
// You might want to pass DRUPAL_BOOTSTRAP_DATABASE instead
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$db_result = db_query('SELECT * FROM {users}');
while ($user_object = db_fetch_object($db_result)) {
// TODO: Use drupal_mail() to send desired emails
// User Name: $user_object->name
// User Email: $user_object->email
// Don't forget to pass 'em through the check_plain()
// ...
}
// ...
Read more at Drupal API: drupal_mail()
drupal_bootstrap()
.
Upvotes: 2