Email all registered users

I’d like to write a scrip to send an email to all registered users.

The aim of this is to notify all users of an outage (and probably resolution of the outage).

Ideally, the ticket would contain the text to be sent in a custom field, the email would be sent on a particular state transition and a filter would be applied to reduce the number of users notified, probably a custom field in the user record.

Just to complicate it, there are about 1200 users, but the email gateway rejects outgoing emails with more than 250 addresses, so it either needs to send 1200 individual emails or batch them up.

So my question is:
Is it possible to iterate the list of registered users in a scrip? Are there are example scrips?


If by “registered users” you mean users RT knows about (both priv and unpriv) then the RT::Users object is probably what you want, with the LimitToEndUsers() method. Maybe something like:

my $currentUser = RT::CurrentUser->new(RT::SystemUser);
my $users = RT::Users->new($currentUser);
while( my $user = $users->Next()) {
   # do your email stuff to $user->EmailAddress();
1 Like

Hi Anthony,

I don’t know, but maybe an alternative for your requirement would be to take a look at the following extension?

1 Like

Thanks, this is what I need.

Much appreciated.