yii2-usuario icon indicating copy to clipboard operation
yii2-usuario copied to clipboard

Send a completely different welcome mail

Open drSun opened this issue 5 years ago • 8 comments

Hello! Is there any way not to send a default welcome email and send my own email in overrode RegisterController? Can't find an option. In fact, I only need to change a layout and html of welcome email, but without touching other emails (recovery etc).

Thank you.

drSun avatar Jan 15 '20 16:01 drSun

Did you try overriding views?

maxxer avatar Jan 16 '20 07:01 maxxer

Did you try overriding views?

Yes, thank you, I know about this possibility, but then I will override all other emails as well, what is not needed. But if this is the only option, I would use it, of course.

drSun avatar Jan 16 '20 10:01 drSun

No, you can just override the ones you need. The not found ones will be fetched from the original source

maxxer avatar Jan 16 '20 10:01 maxxer

No, you can just override the ones you need. The not found ones will be fetched from the original source

I understand this, but I'm talking about layouts, not only about emails :) can I use a different layout only for the welcome email?

drSun avatar Jan 16 '20 10:01 drSun

Really, I'd rather switch off sending default welcome email, and send my own using event 'after registration'. Because as I see, there is even no opportunity to embed images in MailFactory, is it?

drSun avatar Jan 16 '20 11:01 drSun

https://yii2-usuario.readthedocs.io/en/latest/installation/configuration-options/#enableemailconfirmation-type-boolean-default-true

maxxer avatar Jan 16 '20 11:01 maxxer

A very useful option, but it only regulates including or not a confirmation link in welcome mail body.

Anyway, thank you for your help. I decided to copy-paste RegistrationController->actionRegister() and override a MailFactory method makeWelcomeMailerService(). A bad coding style, but can imagine nothing better :(

drSun avatar Jan 16 '20 11:01 drSun

dead link

https://yii2-usuario.readthedocs.io/en/...

Working link: https://yii2-usuario.readthedocs.io/en/latest/install/configuration-options/#enableemailconfirmation-type-boolean-default-true

edegaudenzi avatar Nov 13 '23 11:11 edegaudenzi