ObjectiveSometimes, we get a requirement to send email from Record detail page, clicking on Custom Button (naming Send Email).
I was answering this question in Salesforce Stackexchange Send email on Custom button click? and thought that it might help others.
Here is an approach to handle this requirement.
Note: Only User, Contact, Lead, or Person Account objects are allowed for targetObjectId
If you need to refer specific attributes then download Partner WSDL and refer complexType SingleEmailMessage
It's a fun! Share this post to others in case it helps!