Emailing random password

Hi All,
I apologize if I am doing something careless. I am new to RT>
Anyway, I just added Jessie’s template code to automatically generate a
password for new autogenerated users. However, it never actually
generates a password, and as best I can figure, the main if clause is
always negative, even when it is a new user.
Thanks in adavance for all of your help. For Rreference I am
including a copy of the code I am using, as I found in the listserv
archives.

Regards,
Erek

{
*RT::User::GenerateRandomNextChar = &RT::User::_GenerateRandomNextChar;

if (($Transaction->CreatorObj->id != $RT::Nobody->id) &&
(!$Transaction->CreatorObj->Privileged) &&
($Transaction->CreatorObj->__Value(‘Password’) eq ‘NO-PASSWORD’)
) {

my $user = RT::User->new($RT::SystemUser);
$user->Load($Transaction->CreatorObj->Id);
my ($stat, $pass) = $user->SetRandomPassword();

if (!$stat) {
$OUT .=
“An internal error has occurred. RT was not able to set a password for
you.
Please contact your local RT administrator for assistance.”;

}

$out .= "
You can check the current status and history of your requests at:

“.$RT::WebURL.”

When prompted, enter the following username and password:

Username: ".$user->Name.“
Password: “.$pass.”
”;
}
}