I am trying to extract the email domain from each contact record from the email address field and use it to query for matching values on the account record.
How do I loop over a list of contact records and query a field on the account record while grabbing just the domain part of the email address from the email field on each given contact in the loop? This is the code I have so far:
for(Contact con : contacts) {
if( con.email != null ) {
contactList.add( con );
}
}
for(Account acc : [SELECT Id, Name FROM Account WHERE account_email__c =
**contactemaildomain**]
) {
.. code ..
}
I am confused on how to use the values from my contactList in my query to the account.