Send email through rest api possible?

Hi, due to a customer request, I am wondering if it is possible to create and send emails directly by the rest api.
The request would be to trigger email creation/sending in suitecrm through an external application. The Data/ Body for the email would be supplied by the external application but SuiteCRM should do the sending/. So I would like to know if it is possible at all to send an email from suitecrm by api call.
Did anyone allready encounter such a requirement?
Maybe there is a workaround if its not possible to send the email by rest api, like creating the email by api, and have a workflow handle the email sending later on. I couldn’t figure out if its possible to configure a workflow to acctually send the email-record itself after creation/update tho.

Does anyone have experiences or advices concerning this matter?

Thanks and wbr,

Martin

Martin,

this is not something that I have come across before but I cant see why it wouldnt be possible. depends on what you are wanting to do e.g

1,send a email when a record is updated. - which you could do with workflow fairly easily.

2, extend the API to allow the ability to send an email so it could be recorded in Suite.

im afraid that the second would be more complex using code to send the email using Sugars Email functionality.

1 Like

Hi Ian, thanks for you reply.
The thing is, whatever record we are creating ( be it a email record itself or some custom entity) I need the email that is going to be sent through the worflow to contain information from the record that triggered the workflow. For example, the mail body. We were thinking about creating an email record by the rest api, and have an workflow send the email acctually after creation.
Anyways I am affraid we might end up extending the api.

You might be better extending the API if you are planing on using it for a number of different modules as you would need a worfflow to catch each module which could be affected.

however workflow does allow the ability to send a email with data from other records. e.g contacts name, email address etc. as it uses the email templates to produce the email.

Ian, I did setup a simple workflow with a send-email action, and an emailtemplate to “map” data from a customentity the workflow fires on.
I can grab data from the source entity fairly easy in the template but I am wondering if it is possible somehow to add an attachment to the generated email.
I couldn’t find any information if this is possible at all, do you know if this is possible?

Cheers,
Martin

Hi Martin,

You can add attachments to a email template within the email module(under email templates) however that you mean the same template is sent every time the workflow is fired.

I am not aware of workflow being able attach a file based on a certain record, This would be good if that appeared in the workflow module at somepoint.

Hopefully that helps,

Ian.

Hi,

just want to give a quick update on the approach we used to handle this requirement.
We created a custom modul to “stage” the emails that we want to send out, containing all the Information and links to attachments we need for later Email sending.
The records for this modul are created by an external application via SOAP api. When everything is persisted in Suite, we set a flag on the record, flagging it as ready to be sent.
We then have a logic hook implemented that handles the actual email-sending though SuiteCRM.

Cheers for the help ,

Martin

1 Like