Support (offered by community volunteers) > Using CiviMail

Automatically add email recipients based on relationship

(1/1)

kung:
I'm looking for insight on the best way to automatically add email recipients based on a relationship.

Here's the use case: I have an Organization contact type called "Account."  I have an Individual type called "Account Contact."  They have a contact-is / contact-for relationship, and they also have the same legal_identifier field in civicrm_contact.

When a user sends an email to an account, I want to automatically add the account's account contacts as recipients (or, better, give the user a checkbox on the form to include them).  How to do that?
Should I have modeled my contact types differently? Or, if not, I'm thinking the best way to build it is to use a form_alter hook. 
Any other, better ideas?
Thanks!

jimurl:
Hi kung,

A little more info: what do you mean by-
"When a user sends an email to an account,  ..."

What kind of user (an administrator? or an end user who might be sending an email to another end user/contact?), and using what method to send an email (CiviMail bulk mailing? or using the "Send Email" action from the actions menu? ) Or do you mean WHENEVER an email is sent using any method?

kung:
Hi. Sorry for not replying sooner.  An administrator would be doing the mailing.  The method will be Actions / Send Email: In this case the admin will enter the Account name or choose Accounts from search results, and somehow the system will find out the Account Contacts for that account (via the relationship) and add them to the recipient list.
Any suggestions you might have would be most welcome.
Thanks.

Navigation

[0] Message Index

Go to full version