Using TinyMCE in content rules

Hi, I use content rules a lot, especially to email to users and groups. The email only allows text with is unformatted. Is there a way to use TinyMCE as the editor for content rules? is there a reason that it isn't.
I am working with a programmer; so I won't be trying to do this myself. I think it would be a good addition to the email content rule.

Any thoughts would be appreciated and passed along to the programmer

I think the reason is that constucthing html e-mails that 'look good' and/or even show correctly in a large percentage of e-mail clients nowadays is very very difficult and only works in highly specialised editors from companies like MailChimp that have a huge amount of research behind them.

Off couse if you limit to a few header styles, bold, italic and left/right alignment, the scope is limit. But as soon as you start using tables, 'advanced' css or want to insert images, it is a very specialised knowledge domain. E-mail clients put all kinds of restrictions, so you'll have to use inlinen css, deliver the images also inside the e-mail, etc. etc.

I second Fred's advice.

HTML email is a can of worms you don't want to open unless you have a sizeable budget and a lot of time to invest in comparing the rendering in different email clients. There are noticeable differences between versions of some clients (think Outlook), operating systems and platforms (think mobile vs web vs desktop) which will make your (programmer's) head spin.

We tried and failed, eventually went the mailchimp route (which btw. also solved our EU data protection requirements).

To get it 'very good' might be difficult, but getting in 'good enough' might not be so difficult.

You should add the css 'inline', but I tried this as an action (not content rule and I have not used it in production… the code was something like this:

    def send_email(self, context, request, receipt):
    title = context.Title()
    description = context.Description()
    body_html =  u'<html><div class="mailcontent"><h1 class="documentFirstHeading">' + title.decode('utf-8') + u'</h1><div class="documentDescription description">' + description.decode('utf-8') + u'</div>' + context.text.output + u'</div></html>'

    #for 'non HTML mail clients'
    transforms = api.portal.get_tool(name='portal_transforms')
    stream = transforms.convertTo('text/plain', body_html, mimetype='text/html')
    body_plain = stream.getData().strip()

    messages = IStatusMessage(self.request)

    # ready to create multipart mail
    try:
        mailhost = api.portal.get_tool(name='MailHost')
        # discovered that plone api might do this better
        # plone.api.portal.send_email , maybe
        outer = MIMEMultipart('alternative')
        outer['To'] = receipt
        outer['From'] = api.portal.get_registry_record('plone.email_from_address')
        outer['Subject'] = title
        outer.epilogue = ''

        # Attach text part
        text_part = MIMEText(body_plain, 'plain', _charset='UTF-8')

        # Attach html part with images
        html_part = MIMEMultipart('related')
        html_text = MIMEText(body_html, 'html', _charset='UTF-8')
        html_part.attach(html_text)

        # Add images to the message
        #for image in issue_data['images_to_attach']:
        #    html_part.attach(image)
        outer.attach(text_part)
        outer.attach(html_part)

        mailhost.send(outer.as_string())

        messages.add(_("sent_mail_message",  default=u"Sendt til $email",
                                             mapping={'email': receipt },
                                             ),

type="info")

#add some code for what to do if it fails.

I never managed to 'inline' the images

PS: It might be better to use plone api to send emails

thanks for the input.

I'm also looking into: https://pypi.org/project/collective.mailchimp/

does anyone have experience with this product? What I'm maily looking for is a way to link our Plone user database to mailchimp - removing need to keep two databases. Does the collective.mailchimp do this?

Also, I'll talk with Luke regarding the 'good enough' from @espenmn.

thanks a lot for your thoughts. I post back if I find a good implementation method with Luke

Hey @rileydog.... we've used this on two recent projects.

@b4oshany worked on it, he might be able to point you in the right direction.

You can take a look at our contactform package which implements HTML E-Mail templates: https://pypi.org/project/operun.contactform/