Page 1 of 1

SOLVED Send mail to user when added to admin area SERVER ERR

Posted: Wed Aug 01, 2012 7:06 pm
by qido
Hi all

First of all I use CMSMS 1.10.3 and I use this UDT with event handler "UserAddPost"
http://wiki.cmsmadesimple.org/index.php ... in_Console

But it gives a server error when adding a new user to the admin panel.

I have so fare figured out that this marked out stop the server error

Code: Select all

if($newuser->email != "" && validate_email($newuser->email)){
  $cmsmailer = $this->GetModuleInstance('CMSMailer');
  $cmsmailer->AddAddress($newuser->email);
  $cmsmailer->SetBody($bodytext);
  $cmsmailer->IsHTML(false);
  $cmsmailer->SetSubject($sitename.' User Account Information');
  $cmsmailer->Send();
}
I tried with just for the UDT

Code: Select all

  
  $cmsmailer = $this->GetModuleInstance('CMSMailer');
  $cmsmailer->AddAddress('somemail@earth.com','tester');
  $cmsmailer->SetBody('<h4>This is a test message</h4>');
  $cmsmailer->IsHTML(true);
  $cmsmailer->SetSubject('Test message');
  $cmsmailer->Send();
And this gives the same error, so it seems like there is something wrong with either the "AddUserPost" event or the mailer.

But so far I had no luck fixing it.

Can any one help?

Re: Send mail to user when added to admin area SERVER ERROR

Posted: Wed Aug 01, 2012 7:08 pm
by calguy1000
There is no $this object when working in a UDT.

Re: Send mail to user when added to admin area SERVER ERROR

Posted: Wed Aug 01, 2012 7:35 pm
by manuel
I don't know if you will be able to send the password to users i but wanted to mention the notifications module just in case...
http://dev.cmsmadesimple.org/projects/notifications

Greetings,
Manuel

Re: SOLVED Send mail to user when added to admin area SERVER

Posted: Sun Aug 05, 2012 7:44 pm
by qido
Thx. Moved me in correct direction.