Plone api send_mail problem

Hi all,
I've a browser view where I use plone api to send an email with a list of user in a specific group:

api.portal.send_email(
                recipient       = destinatario,
                sender          = mittente,
                subject         = 'Nel gruppo sospesi alla data del '+ladatadioggi,
                body            = 'Riepilogo '+bodysospesi
                )

This little snippet works since december 2015 without any problem. But today I'm trouble cause the "body" is printed in the email header rather the email body!!
If I use the "test" in mailhost conf in plone_control_panel the email sent is ok.

Help!
Vito

This is very strange. From the distance, it looks as if some bug (maybe via a different version) has been introduced into your setup.

I would use debugging to find out what happens. Debugging can happen either in a copy of your setup or in an interactive Python session connected to your Plone ("bin/client1 debug", if you are using ZEO; "bin/instance debug" otherwise - however, in this latter case, you must shutdown your Plone).

In an interactive Python session, you must set up an appropriate context to be able to use the Plone api. This involves at least the use of "zope.component.hooks.setSite" to define the Plone portal as current "site" and may involve an emulated login using "AccessControl.SecurityManagement.newSecurityManager".

To help debug sending email, try the printing mailhost add on, which acts only when the client or instance is run in fg mode.

Solved!

A stupid thing: if the "body" variable is composed by only one row I've the problem, if there are two or more rows the body is placed in the "email body" correctly.
Strange.

Vito

Worth filing an issue?

Don you mean an "issue" on the github's plone.api?

A good default place to start is in the issue tracker for Products.CMFPlone https://github.com/plone/Products.CMFPlone/issues and in this case I think probably the issue is not so much in the API but in the code that is invoked by the API.