I have a custom object 'XYZ' on which I have a button "Send Email", When user click on this button a email will be sent to the email address mentioned on the record of XYZ. Now my requirement is to track history of email, when some one sends a email, Activity history should be updated as we see with salesforce standard functionality. Can any one please suggest me how this functionality can be achieved? Please comment the code that will be very helpful.
Thanks.