Answers.Body: <p>CiviMail does this at the time when the mailing is created, i.e. when the groups are chosen etc.</p>
  
  <p>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.</p>
  
  <p>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</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-24T00:44:01.087Z
Answers.Text: 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
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-16T16:08:49.993Z
Answers.LastActivityDate: 2015-04-16T16:08:49.993Z
Answers.UserDisplayName: Donald Lobo
Answers.Body: <p>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.</p>
  
  <p>It's called when editing and scheduling the email, but not when it is about to be sent.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T23:51:33.353Z
Answers.LastActivityDate: 2016-05-23T23:51:33.353Z
Answers.UserDisplayName: Ken West
Answers.Body: <p>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 :-)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-05T13:27:48.893Z
Answers.Text: 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)?
Answers.UserDisplayName: A. Block
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-06T11:41:30.880Z
Answers.Text: 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.
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-16T11:52:19.997Z
Answers.LastActivityDate: 2015-04-16T11:52:19.997Z
Answers.UserDisplayName: ErikH - CiviCooP
Answers.Body: <p>I can confirm that this is still the behaviour of civiMail and Smart Groups.</p>
  
  <p>There is an extension that addresses this:</p>
  
  <p><a href="https://github.com/3sd/civicrm-recalculate-recipients" rel="nofollow noreferrer">https://github.com/3sd/civicrm-recalculate-recipients</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-09T05:00:27.903Z
Answers.Text: is this different for standard (not smart) groups? do those also only go to group members when the mailing is scheduled?
Answers.UserDisplayName: ericG
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-08T13:51:29.287Z
Answers.LastActivityDate: 2019-07-08T13:51:29.287Z
Answers.UserDisplayName: A. Block
Body: <p>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?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-10-28T13:45:57.757Z
Comments.Text: Still true in Nov 2024 - contacts removed from a group still get mailings scheduled prior to the removal date.
Comments.UserDisplayName: yurg
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-10-29T14:27:23.503Z
Comments.Text: Note the answer below highlighting the 'recalculate recipients' extension that may well address this.
Comments.UserDisplayName: Graham
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-10-29T15:29:02.483Z
Comments.Text: Thank you. We'll see if the extension still works after the next mailing in a few days.
Comments.UserDisplayName: yurg
Tags: <civimail><smartgroups>
Title: CiviMail and Smart Groups: when does CiviCRM identify the actual list of email recipients?
ThreadText: # CiviMail and Smart Groups: when does CiviCRM identify the actual list of email recipients?
  
  (Asked by: username_0 on 2015-04-16)
  
  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?
  
  **Tags:** civimail, smartgroups
  
  > **Comments:**
  > **username_1**: Still true in Nov 2024 - contacts removed from a group still get mailings scheduled prior to the removal date.  
  > **username_0**: Note the answer below highlighting the 'recalculate recipients' extension that may well address this.  
  > **username_1**: Thank you. We'll see if the extension still works after the next mailing in a few days.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_6 on 2019-07-08. Score: 4 | Accepted answer
  
  I can confirm that this is still the behaviour of civiMail and Smart Groups.
  
  There is an extension that addresses this:
  
  <https://github.com/3sd/civicrm-recalculate-recipients>
  
  > **Comments:**
  > **username_7**: is this different for standard (not smart) groups? do those also only go to group members when the mailing is scheduled?  
  
  ---
  
  ### Answer by username_2 on 2015-04-16. Score: 5
  
  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
  
  > **Comments:**
  > **username_3**: 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  
  
  ---
  
  ### Answer by username_4 on 2016-05-23. Score: 3
  
  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.
  
  
  ---
  
  ### Answer by username_5 on 2015-04-16. Score: 2
  
  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 :-)
  
  > **Comments:**
  > **username_6**: 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)?  
  > **username_5**: 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.  
  
  ---
  
  