How are Email addresses stored?
A look at how SuiteCRM stores Email addresses in the Database. This applies to all entities that have email addresses.
Currently this post covers only the simple topic of storing Email addresses. One day I plan to expand it to include how actual Email content is stored.
The several entities that can have Email addresses
In SuiteCRM, all of these entities can have Email addresses: Contacts
, Leads
, Targets
, Users
, Accounts
, and perhaps more that I’m not remembering now.
Developers call entities beans
because of the way they are internally represented and handled.
Database structure
There is a table handling the relationship between people and their email addresses called email_addr_bean_rel
.
In there, the columns bean_id
and bean_module
specify the entity that has an email address. For example, if bean_module
is Users
, you can use bean_id
to look the user up in the users
table.
Then there is a column called email_address_id
which is a reference to the id
column in table email_addresses
.
Example Query
Here is a sample query to extract a list of Users
with their Email addresses:
This can easily be adapted to the other entities like Contacts
, Leads
, etc.