[SOLVED] Collective.contentrules.mailtogroup versions

I need to send mail to a group.

I see that collective.contentrules.mailtogroup works in Plone 5.1

Does anyone know how much work is required to get it to work for 5.2 ?
Alternatively: Is there any other similar product / way ?

1 Like

I see that there is a branch for python3 that has been updated 8 months ago.

try to ask @agitator if it's ready or need some love :wink:

Py3 by agitator · Pull Request #30 · collective/collective.contentrules.mailtogroup · GitHub works for me :wink:

Thanks.

UPDATE: it works for me, too. Thanks

UPDATE 2: I did a test on python2.7 / Plone 5.2, and I dont think any of the branches works. @agitator ping me if the py3 branch is supposed to work with 2.7/5.2 and I will try to troubleshoot.

UPDATE 3: The 'old version' seem to work on 5.2 / 2.7, but maybe it has problems with unicode errors (I did a quick test on an existing site and it gives error (and it has ÆØÅ in name and usernames etc, and removing them fixes the error):

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 371, in publish_module
  Module ZPublisher.WSGIPublisher, line 274, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module plone.z3cform.layout, line 63, in __call__
  Module plone.z3cform.layout, line 57, in update
  Module z3c.form.form, line 281, in render
  Module z3c.form.form, line 163, in render
  Module Products.Five.browser.pagetemplatefile, line 126, in __call__
  Module Products.Five.browser.pagetemplatefile, line 61, in __call__
  Module zope.pagetemplate.pagetemplate, line 135, in pt_render
  Module Products.PageTemplates.engine, line 378, in __call__
  Module z3c.pt.pagetemplate, line 176, in render
  Module chameleon.zpt.template, line 302, in render
  Module chameleon.template, line 192, in render
  Module 968fead4cf629b09d90e80bb315df6ac, line 117, in render
  Module 00ac4c8414cdcee1f3f20dd5b63850fa, line 1922, in render_titlelessform
  Module 00ac4c8414cdcee1f3f20dd5b63850fa, line 488, in render_fields
  Module 00ac4c8414cdcee1f3f20dd5b63850fa, line 145, in render_widget_rendering
  Module 00ac4c8414cdcee1f3f20dd5b63850fa, line 1166, in render_field
  Module zope.tales.expressions, line 250, in __call__
  Module Products.PageTemplates.Expressions, line 225, in _eval
  Module Products.PageTemplates.Expressions, line 155, in render
  Module zope.browserpage.simpleviewclass, line 41, in __call__
  Module zope.browserpage.viewpagetemplatefile, line 81, in __call__
  Module zope.browserpage.viewpagetemplatefile, line 49, in __call__
  Module zope.pagetemplate.pagetemplate, line 135, in pt_render
  Module Products.PageTemplates.engine, line 378, in __call__
  Module z3c.pt.pagetemplate, line 176, in render
  Module chameleon.zpt.template, line 302, in render
  Module chameleon.template, line 215, in render
  Module chameleon.template, line 192, in render
  Module 23b9bc38728b56351dfab04232bb2985, line 586, in render
  Module 23b9bc38728b56351dfab04232bb2985, line 456, in render_widget_wrapper
  Module zope.tales.expressions, line 250, in __call__
  Module Products.PageTemplates.Expressions, line 225, in _eval
  Module Products.PageTemplates.Expressions, line 155, in render
  Module plone.app.z3cform.widget, line 123, in render
  Module plone.app.widgets.base, line 180, in __init__
  Module plone.app.widgets.base, line 229, in _set_items
  Module lxml.etree, line 1024, in lxml.etree._Element.text.__set__
  Module lxml.etree, line 747, in lxml.etree._setNodeText
  Module lxml.etree, line 735, in lxml.etree._createTextNode
  Module lxml.etree, line 1540, in lxml.etree._utf8
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

 - Expression: "widget/render"
 - Filename:   ... rm-3.2.2-py2.7.egg/plone/app/z3cform/templates/widget.pt
 - Location:   (line 39: col 46)
 - Source:     ... xt" tal:replace="structure widget/render"
                                              ^^^^^^^^^^^^^
 - Expression: "widget/@@ploneform-render-widget"
 - Filename:   ... rm-3.2.2-py2.7.egg/plone/app/z3cform/templates/macros.pt
 - Location:   (line 99: col 81)
 - Source:     ... place="structure widget/@@ploneform-render-widget"/>
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Expression: "context/@@ploneform-macros/titlelessform"
 - Filename:   ... ctive/contentrules/mailtogroup/actions/templates/mail.pt
 - Location:   (line 1: col 24)
 - Source:     ... k use-macro="context/@@ploneform-macros/titlelessform" />
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  repeat: <Products.PageTemplates.engine.RepeatDictWrapper object at 0x7f1636cbcd20>
               context: <SelectWidget 'form.widgets.members'>
               views: <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x7f1636bfa350>
               modules: <zope.pagetemplate.engine.TraversableModuleImporter object at 0x7f165a836a90>
               args: ()
               nothing: None
               target_language: None
               default: <DEFAULT>
               request: <WSGIRequest, URL=http://myserver:8080/christiegaarden/++rule++rule-2/+action/plone.actions.MailGroup>
               loop: {}
               template: <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x7f1645223850>
               translate: <function translate at 0x7f1636cfaed8>
               options: {}
               view: <Products.Five.browser.metaconfigure.RenderWidget object at 0x7f1636bfa2d0>

does anyone on this thread have any idea of the difficulty of bringing this up to Plone 6 classic?

I see here collective.contentrules.mailtogroup · PyPI work has stalled at 5.1

Thanks

Did you try the Python 3 version?

It might work: https://github.com/collective/collective.contentrules.mailtogroup/tree/py3/collective/contentrules

Once there was a plan to integrate this feature in plone.app.contentrules. Any takers?

Espen - thanks I'll check that out.

Including this in Plone is discussed here: Variable substitutions partly not working · Issue #4 · collective/collective.contentrules.mailtogroup · GitHub

No discussion for a long time. Something this basic belongs in Plone and hope it can happen.

after i test the version Espen posted, i come back and let everyone know the results.

I did some changes yesterday, and with those it (the py3 branch) seems to work in Plone 6.0.6.

Is there anyone that can give me some help / guidance about / with the failing tests?

if this gets fixed, could it then be part of a content rule as mentioned above?
Years ago i was trying to get this inlcude. I don't understand how site admins send out emails to groups of people without it.

You should update black to 22.3.0

Thanks for the commits, seems to work now

@1letter thanks for the answer. @espenmn and i are working on a project that will use this. your answer helped Espen solve this for my project. However, can't we get this into Plone so everyone can benefit?
How have site admins been sending mail to groups without this?
i see Espen ran some tests and it failed one. is this why it can't be included in Plone?
Espen and you have solved my problem, but i would like to see all users benefit.
Can this be included in future Plone versions?

@rileydog I think, the core should be small. An addon is enough to provide the functionality. Activate the addon, that should be enough. No reason to blow up the core. But the addon need some work to be ready for Plone 6.

hello, thanks for the reply and I understand the decision; however, I would ask you to reconsider for maybe 6.1 release. Here is why:

I know keeping the core small is important for the volunteers maintaining Plone. I wouldn't have suggested adding this product if: 1) it didn't solve a specific and important need: sending emails to groups. Without this ability the value of content rules is much reduced. 2) it has a small footprint. (No UI - so i believe it would work on volto. I only use Classic, so I don't know.)

I realize from the tests that more work needs to be done so there is impact to Plone volunteers.

I will continue to use this as a plugin.

Thanks again for your time replying and have a good day.

Oh, i see there is a stalled old PLIP PLIP: Bring collective.contentrules.mailtogroup into Plone core · Issue #1808 · plone/Products.CMFPlone · GitHub

Great. the discussion states the plip was approved. Do you think it should be rolled into a future version of Plone.

I found something that looks like a bug in Python 3 version (Plone 6).

  1. add a new mailtogroup
  2. Do not set any 'from info' in the rule
  3. Add 'sent from name' in control panel to 'Some Name'

The mail are not sent.

If I change the from name in control panel to 'my@email. com ', the mail is sent.

Can anyone with earlier versions installed check if this is also the case?

I will try to fix this ( c.mailtogroup) next week.

Please add an issue

Done (but still would be nice if I knew if this has been a problem before or not since I changed a bit in the 'mailing part'