If I set up a mailing to a smart group, and schedule it to go out one month from today, will CiviMail send to the contacts in the smart group as they are defined at the point when I create the mailing, or at the point when the mailing is sent out?
4 Answers
CiviMail does this at the time when the mailing is created, i.e. when the groups are chosen etc.
The primary reason behind this is to account for permissioning and what contacts to send the mailing to. Doing so at mailing creation time is relatively easy, since we know the contact id of the user, and hence know what contacts the user has permission to send mail to.
It gets a lot more complicated (but not impossible) to do this during mail delivery, primarily because the cron job will need to evaluate the groups in the context of the person who created the mailing
-
so adding the contact_id to the civicrm_mailing_job table could mean that this could be checked later in the process - just recalling eileen's comments about having an 'owner_id" field in more tables– petednz - fuzion ♦May 24, 2016 at 0:44
The function that creates the recipient list is the unfortunately named CRM_Mailing_BAO_Mailing::getRecipients() which clears out the rows in table civicrm_mailing_recipients and reinserts them.
It's called when editing and scheduling the email, but not when it is about to be sent.
I can confirm that this is still the behaviour of civiMail and Smart Groups.
There is an extension that addresses this:
-
is this different for standard (not smart) groups? do those also only go to group members when the mailing is scheduled?– ericGJul 9, 2019 at 5:00
I do not know out of the top of my head, but I would start checking by looking at the table civicrm_mailing_recipients. If the contacts in there are added at the time of mailing creation I know where I would put my money :-)
-
Is this still the case in 2019? That if I use a mailing list Smart Group to schedule 12 months of newsletters in advance, that new subscribers to the list won't be sent the newsletters scheduled in the future, because they weren't in the Smart Group at the time I scheduled the send (12 months earlier for example)?– A. BlockJul 5, 2019 at 13:27
-
As said, that is what I would check :-) I do not know out of the top of my head but it seems a good point to prove first. Jul 6, 2019 at 11:41