I am curious to know, how Salesforce manage attachments which we add while sending an email from activity. Does Salesforce stores those files somewhere in hidden objects and use them once we click on Send Email button? Because if we try to build such functionality, we have to attach the file to some record and include them as an attachment while sending the email.

Is there any possibility to send a file as an attachment without saving into salesforce?

enter image description here

  • 2
    They are saved as ContentVersion (Files) and attached to the Task via a ContentDocumentLink
    – cropredy
    Jun 9, 2022 at 23:51
  • Thank you, but this happens once you click on send button, I mean once email is sent right? I am talking about where the files are temporarily stored after you upload one and meanwhile type something in let say email body i.e. until you click on send button.
    – Rajneesh R
    Jun 13, 2022 at 16:41

1 Answer 1


Files attached to an Email before you click Send exist as

  • ContentVersion
  • with parent ContentDocument
  • with ContentDocumentLink.LinkedEntityId pointing at the current User

So, they are not hidden, just not yet linked to the related record for the Task/EmailMessage you intend to create by clicking Send.

If you click to remove a file from the attached list, Salesforce deletes the ContentDocument (which deletes the ContentVersion and ContentDocumentLink.

You can see all this happen by using SOQL queries like:

SELECT Id, Title FROM ContentDocument WHERE Title = 'Generic Footer'

SELECT LinkedEntityId, ContentDocument.Title 
  FROM ContentDocumentLink 
  WHERE ContentDocumentId = <the id from query 1>

Not the answer you're looking for? Browse other questions tagged .