8 – Drupal way of storing data related to a node


Create a custom content entity with entity_reference fields relating each “email” entity to a node and a user.

The information you’re saving is neither part of the node’s content nor part of the node’s metadata. It is metadata about an email that has been sent. Since the email records aren’t related to any particular revision of the node, you want the email records to remain even if the node is reverted to a previous revision. So you shouldn’t put the email records in a node field of any kind.

Creating a custom content entity is more useful than creating a custom table, because – as you have pointed out – you can make use of the built-in Entity API, which allows you to add field bundles, but also makes it easy to relate your records to node and user entities, and optionally do cleanup if those users or nodes are deleted. If you generate your custom entity using Drupal Console then it will work out of the box with views.