function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mnoorgatmnoorgat 

Sending email to contact using templates

Hi,

1) I need to send an email to a contact. Is this possible using the salesforce api or do I need to use my own smtp server etc. (I need to have it logged in the Activity History section).

2) Ideally I would send the email using one of the existing Email Templates. Is this possible, and if so, how is the merge fields affected?

Any direction here would be useful.

Kind regards,

MI Noorgat
mnoorgatmnoorgat
Since posting this message I have written my app to use its own smtp engine. I'm not using templates (using text files, and my app now does its own mail merging).

I am still stuck on how to add items to the contact "Activity History" section. I need to log the fact that an email has been sent and the content of the email which has been sent. Any pointers?

Thank you.

MI Noorgat
ScotScot

The Activity History is made up of closed activities.  You want to add a task with a status of "Completed". The text of the email, if desired, would go into the Description field.

mnoorgatmnoorgat
Thanks Scot,

Your direction was exactly what I needed.

Kind regards,

mnoorgat
cmarzillicmarzilli
Hey Scott - I have a follow up question. I am sending out an HTML email and I create the task and set the text of the email to the Description field. When I look at the task in salesforce it has all the HTML code in the description. It makes it very hard to read. Is there any way around this? Is there a way to tell SalesForce that this is an html email? I know when we send HTML emails from within SalesForce it either removed or interpreted the HTML code somehow.

Thanks!
ScotScot
It sounds like you're pasting in the full HTML value ... which would produce the results you got.
 
I think you'll need to either find the text version of the email, or remove the html formatting yourself.  I don't think you'll find that there's any way for salesforce to remove the html or to display with it...
 
How to remove it ... sorry, I don't have any great suggestions ...
 
Scot
cmarzillicmarzilli
So basically if I send and HTML email through SalesForce UI then it records it fine with the HTML formatting I used. But if I create an HTML email out side of SalesForce and try to record it as a task via the API it will not record the HTML as part of the message? Not what I has hoped.