[TYPO3-mvc] How to send an email after createAction?

Jochen Rau jochen.rau at typoplanet.de
Mon Nov 30 04:10:42 CET 2009


Hi Dimance.

Dimanche wrote:
>> why not just write your createAction like this:
>>
>> createAction(User $user) {
>> $this->userRepository->add($user);
>> $this->emailService->sendRegistrationEmail($user);
>> }
>>
>> Greets,
>> Sebastian
> Hi Sebastian,
>
> I have tested yours function, but it shown the error message
>
> "Call to a member function sendRegistrationEmail() on a non-object".

That's because there is no emailService shipped with Extbase. You have 
to implement your own. Put you class file in 
typo3conf/ext/my_ext/Classes/Domain/Service/EmailService.php.

> I don't know which class I need to extend my new object, please writing
> down by detail, how can I use the function "sendRegistrationEmail($user)"?

The class EmailService.php could be something like

class Tx_MxExt_Domain_Service_EmailService {

	public function sendRegistrationEmail(Tx_MxClass_Domain_Model_Client 
$client) {
		// implement your code to send an email here
		// tslib_cObj::sendNotifyEmail
	}
}

Regards
Jochen



-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list