Answers.Body: <p>on the sites that are impacted by this, it sees an empty selection method as having value
  <a href="https://github.com/civicrm/civicrm-core/pull/20536#issuecomment-915643323" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/20536#issuecomment-915643323</a></p>
  <p>the solution that I'm using for now is changing</p>
  <pre><code>if ($email_selection_method !== 'automatic' &amp;&amp; !$location_type_id)
  </code></pre>
  <p>to</p>
  <pre><code>if ($email_selection_method !== 'automatic' &amp;&amp; is_numeric($location_type_id))
  </code></pre>
  <p>in line 401 of  CRM/Mailing/BAO/Mailing.php</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-08T23:42:22.540Z
Answers.LastActivityDate: 2021-09-08T23:42:22.540Z
Answers.UserDisplayName: ericG
Body: <p>after the most recent update, none of my clients can send via CiviMail if they start from a search result.
  the error in all cases is &quot;You have selected an email Selection Method without specifying a Location Type. Please go back and change your recipient settings (using the wrench icon next to &quot;Recipients&quot;).&quot;
  but they are starting from search results, there is no wrench.
  I can't find anywhere to set the default type to &quot;automatic&quot; (which I now have to do each time in civimail for any contacts to show when selecting already existing groups)
  these sites are all on the most recent version of Drupal 7 and civi 5.40.2
  any ideas?</p>
  <p>to replicate:
  start from search. search for a set of contacts. select the contacts and then from the action menu select Email- schedule/send via CiviMail</p>
  <p>you will get the error &quot; Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
  You have selected an email Selection Method without specifying a Location Type. Please go back and change your recipient settings (using the wrench icon next to &quot;Recipients&quot;).&quot;</p>
  <p><a href="https://i.sstatic.net/2gJwR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2gJwR.png" alt="enter image description here" /></a>
  <a href="https://i.sstatic.net/4mcpI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4mcpI.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-19T20:28:47.710Z
Comments.Text: don't personally use that method much, can you replicate on https://dmaster.demo.civicrm.org/ ? or does that site not let you get to the point where the problem shows (i just tried and didn't see your error above)
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-19T21:49:45.883Z
Comments.Text: I've only hit the issue on 5.40.2 , none of the Drupal 7 demos are running that version 
  
  and I did find one client site where the error does not happen. 
  the only thing these other sites share in common is that they all started way back on civi 4.3 (upgraded over the years to 5.40.2) 
  maybe there's some ancient cruft in my way
Comments.UserDisplayName: ericG
Tags: <civimail>
Title: can no longer send via civimail from search results
ThreadText: # can no longer send via civimail from search results
  
  (Asked by: username_0 on 2021-08-19)
  
  after the most recent update, none of my clients can send via CiviMail if they start from a search result.
  the error in all cases is "You have selected an email Selection Method without specifying a Location Type. Please go back and change your recipient settings (using the wrench icon next to "Recipients")."
  but they are starting from search results, there is no wrench.
  I can't find anywhere to set the default type to "automatic" (which I now have to do each time in civimail for any contacts to show when selecting already existing groups)
  these sites are all on the most recent version of Drupal 7 and civi 5.40.2
  any ideas?
  
  to replicate:
  start from search. search for a set of contacts. select the contacts and then from the action menu select Email- schedule/send via CiviMail
  
  you will get the error " Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
  You have selected an email Selection Method without specifying a Location Type. Please go back and change your recipient settings (using the wrench icon next to "Recipients")."
  
  [![enter image description here](https://i.sstatic.net/2gJwR.png)](https://i.sstatic.net/2gJwR.png)
  [![enter image description here](https://i.sstatic.net/4mcpI.png)](https://i.sstatic.net/4mcpI.png)
  
  **Tags:** civimail
  
  > **Comments:**
  > **username_1**: don't personally use that method much, can you replicate on https://dmaster.demo.civicrm.org/ ? or does that site not let you get to the point where the problem shows (i just tried and didn't see your error above)  
  > **username_0**: I've only hit the issue on 5.40.2 , none of the Drupal 7 demos are running that version   and I did find one client site where the error does not happen.  the only thing these other sites share in common is that they all started way back on civi 4.3 (upgraded over the years to 5.40.2)  maybe there's some ancient cruft in my way  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-09-08. Score: 1 | Accepted answer
  
  on the sites that are impacted by this, it sees an empty selection method as having value
  https://github.com/civicrm/civicrm-core/pull/20536#issuecomment-915643323
  the solution that I'm using for now is changing
  if ($email_selection_method !== 'automatic' && !$location_type_id)
  
  to
  if ($email_selection_method !== 'automatic' && is_numeric($location_type_id))
  
  in line 401 of  CRM/Mailing/BAO/Mailing.php
  
  
  ---
  
  