I'm trying to replicate the Lightning experience of sending a Contact an email with an email template, using the REST API.

It looks like my SOAP chances are better than REST, but I'd like to avoid SOAP if possible (and APEX is not an option, as I want this to be a universal solution and not for one particular org.)

Am I out of luck? Or is there some sort of 'Action' with a suitable parameter?

Edit: I'm trying to replicate the action of sending an email in Lightning, beside the 'Account' or 'Contact' section, say. You can email a contact, or enter a freeform 'to'. Salesforce initiates the send, by default as the logged-in user's email address as 'from'.

A template may be used also.

I'd like to initiate such an email via REST, presumably with parameters such as to, bcc, subject, optional templateid, etc.

I've tried

await myForceClient.CreateAsync("EmailMessage", 
  new { TextBody = "Email body goes here", Subject = "Interesting subject", 
  ToAddress="rob@somecorp.com", FromAddress="oflahero@mycompany.com" 

...but this doesn't send it (it saves as draft somewhere, but how do I 'send' it?)

As follows:

Lightning screen capture.

It's been a while since this topic arose last (~2 years) so I'm hoping there might be some progress in the intervening time.

  • 1
    Are you trying to send this direct via a REST service or using Outbound email services? Your question is unclear since you've not provided any code or a reference to the feature that you're speaking of. I'm not aware of any feature that enables outbound email services via REST. – crmprogdev Sep 8 '17 at 11:46
  • Direct via REST. I've added more info above. – oflahero Sep 8 '17 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.