Is there an easy way in Plone to receive email notifications when new users join the portal?

I want to receive email notifications to the portal email address when a new user joins the portal.

I assume that for this you need to write a new product.

Is there such a product already (for Plone 4)?

I checked the content rules, but AFAICT could only work if I made users happy with something like membranes / remember, but that would be superfluous for my requirements.

+2
source share
4 answers

I do not think such a product already exists.

To create a package that adds a content rule condition, it must be trivial, which allows you to write a content rule for the Products.PluggableAuthService.interfaces.events.IPrincipalCreatedEvent event.

Plone database documents how to create such a package .

+5
source

You can easily customize the register.pt template, add a simple PythonScript call by sending an email through the MailHost api.

Performing the correct setup for plone.app.users.browser.register.py is much more complicated.

+1
source

You can also just go through login_next to the Python Script Controller (you can also distinguish other similar objects in the / plone _login area of ​​the Plone main product, which end with the extension ".cpy") that you write, which sends (maybe notifyMangersUponLogin), and not the default for switching to login_success.

Then try passing CPT Script to login_success to continue the MVC sript / page stream that is supplied by Plone if you need it.

To use the controller page templates (.cpt files) / Scripts (.cpy files), it allows not only copying the user version of login_next.cpy to its own path to the product outline, but also the login.cpy.metadata file, which defines the success actions / MVC / script page logical flow failure.

In Plone 4.0.2, you will find Plone-dependent scripts / templates under a path such as: / buildout -cache / eggs / plone-4.0.2-py2.6.egg / Products / CMFPlone / skins / plone_login regarding your structure assembly.

+1
source

If you want to do it right, follow the directions of Martijn above. If you want another dirty solution, do the following:

  • make a copy of register.cpy
  • enter the following code:

    context.MailHost.send ('Content-Type: text / plain \ n \ n' + 'The user has registered:' + str (username),
    mfrom = ' me@gmail.com ",
    mto = ' you@gmail.com ", subject =' User Registration ',)

0
source

Source: https://habr.com/ru/post/1380124/


All Articles