Answers.Body: <p>I had this question also and just figured it out!</p>
  
  <p>Civimail always includes a List-Unsubscribe header in the messages it sends out (<a href="https://issues.civicrm.org/jira/browse/CRM-3251" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-3251</a>).</p>
  
  <p>That header is invisible to most recipients and is intended as a way for mail clients to provide easy and standardized unsubscribe mechanisms (<a href="http://www.list-unsubscribe.com/" rel="nofollow noreferrer">http://www.list-unsubscribe.com/</a>). </p>
  
  <p>I note that google doesn't seem to do anything with it, though they do expose the list unsubscribe option for mailman lists, or used to .. But, it appears that Windows Live does use it, so anyone using that software that receives Civimail can use it.</p>
  
  <p>The only clue I had was in my apache logs - the time of the unsubscribe matched a soap request that came in via UAS/CiviSMTP that handles the bounces for this domain.</p>
  
  <p>Thanks to Leyla UAS/CiviSMTP support (<a href="http://www.civismtp.com/" rel="nofollow noreferrer">http://www.civismtp.com/</a>) for confirming this idea.</p>
  
  <p>For bonus points, assuming you really only want people to opt-out instead of unsubscribing, you can include this in a custom extension or module, changing 'hook' to the name of your custom extension or module.</p>
  
  <pre><code>function hook_civicrm_alterMailParams(&amp;$params, $context) {
    if ('civimail' == $context || 'flexmailer' == $context) {
      $params['List-Unsubscribe'] = str_replace('mailto:u.','mailto:o.',$params['List-Unsubscribe']);
    }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-30T14:39:39.443Z
Answers.Text: My solution recently stopped working when the client switched to using Mosaico - turns out the use of flexmailer caused this solution to stop working, so I've just updated it above. Updating from 4.6 to 4.7 didn't cause any issues.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-14T21:44:10.553Z
Answers.LastActivityDate: 2018-03-30T14:38:15.007Z
Answers.LastEditDate: 2018-03-30T14:38:15.007Z
Answers.UserDisplayName: Alan Dixon
Answers.Body: <p>I suspect that unsubscribes are a subset of opt out.  So in CiviCRM, when a user opts out, they are also automatically unsubscribed from the mailing list groups you used.</p>
  
  <p>As opposed to those that might unsubscribe (if you had included that link) wherein they would be removed from the mailing list group they are in but would not have been opted out. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T21:08:43.800Z
Answers.Text: Thanks for the quick reply! They don't seem to be a subset of the opt outs, since their records aren't flagged with any red messages. The mailing groups I used were temporary, so that's not gonna help. This seems like some kind of glitch. Should I assume they want off the list? So, I'll have to look for these after every mailing and opt them out manually? Bummer. I'm using 4.5.8 with WordPress. We tried 4.6.6, but CiviMail doesn't work with WP. You always get 0 recipients. We we had to backtrack..
Answers.UserDisplayName: jimcrist
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T21:24:14.397Z
Answers.Text: I guess I can find them with the advanced search, keep adding them to a permanent group and keep excluding that group from emails. What a pain! It's weird that you can't see this "unsubscribe request" flag when you look at their contact record.
Answers.UserDisplayName: jimcrist
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T21:30:16.633Z
Answers.Text: What are your outbound email settings?
Answers.UserDisplayName: DaveD
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T23:23:37.030Z
Answers.Text: I'm using SMTP on DreamHost. On my mailing 92 people opted-out and only 5 people had this "unsubscribe request". Also, I was wondering if CiviMail captures anything when people hit the spam button? Any chance 5 people hit the spam button? Thanks again!
Answers.UserDisplayName: jimcrist
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T23:27:18.617Z
Answers.Text: No, the spam button is only generally with their ISP.  Too many spam button presses and the ISP just blocks your incoming mail.  
  
  Your prob is interesting.  Gotta think about it.
Answers.UserDisplayName: DaveD
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T23:27:53.887Z
Answers.Text: Hmmm... do you have bounce processing set up?
Answers.UserDisplayName: DaveD
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-30T01:42:33.513Z
Answers.Text: Oh, yeah. I had 863 bounces and as far as I can tell all those contact records got marked properly (on hold).
Answers.UserDisplayName: jimcrist
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-30T08:36:07.603Z
Answers.Text: Hmm, I've noticed some of this (Drupal 7, Civi 4.4) but haven't investigated it in much detail. AFAIK we only used the opt-out token too.
Answers.UserDisplayName: DaveFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-14T22:45:49.813Z
Answers.Text: This is not correct, unsubscribes are not a subset of opt-outs. There's a fair amount of confusion between the two and it's not a good idea to be confusing them further. Please edit your post.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-29T20:56:39.403Z
Answers.LastActivityDate: 2015-09-29T20:56:39.403Z
Answers.UserDisplayName: DaveD
Answers.Body: <p>It's weird indeed. Are you using an external provider to handle the mailings (eg mandrill or mailjet?) by any chance?</p>
  
  <p>Given the low number, I would suggest you to contact the 5 to tell them that you quite don't understand what happened with your mail server, if they could remember and explain you what they did to unsubscribe, it'd be super useful for you to understand their workflow.</p>
  
  <p>(be clear it's a personal email, not a mass mailing one and that you will remove them from the mailing list). I would send them from your mail client, not via civi</p>
  
  <p>Please update us on your finding.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T14:26:30.160Z
Answers.LastActivityDate: 2015-10-28T14:26:30.160Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>OK - I think I have this (thanks for input from  @pradpnayak)</p>
  
  <p>according to the <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailParams/#adding-custom-headers-to-the-email" rel="nofollow noreferrer">docs for hook_civicrm_alterMailParams</a>:</p>
  
  <blockquote>
    <p>You can add custom headers by appending to $params['headers']. Example:</p>
    
    
  
  <pre><code>$params['headers']['X-My-Header'] = 'my header value';
  </code></pre>
    
    <p>The headers key may not exist in the $params array when passed into the hook. </p>
  </blockquote>
  
  <p>so this was the codce in an extension to unset the existing 'List-Unsubscribe', and put in a NULL replacement into the headers:</p>
  
  <pre><code>
  /**
   * Implements hook_civicrm_alterMailParams().
   *
   * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
   */
  function custom_civicrm_alterMailParams(&amp;$params, $context) {
    if ($context == 'flexmailer' || $context == 'civimail') {
      // remove existing header
      unset($params['List-Unsubscribe']);
      // replace via the 'headers' key
      $params['headers']['List-Unsubscribe'] = NULL;
    }
  }
  
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-20T12:03:46.667Z
Answers.LastActivityDate: 2020-02-20T12:20:24.873Z
Answers.LastEditDate: 2020-02-20T12:20:24.873Z
Answers.UserDisplayName: Marsh
Body: <p>I just did our first email blast and it went pretty well. I'm using the token {action.optOutUrl} in the footer, plus the domain address, but that's it. The Opt Outs appear to have worked fine and they're labeled "No Bulk Emails (User Opt Out)" in the CiviCRM database. The bounces processed properly as well.</p>
  
  <p>The weird thing was that the Mail Report shows that 5 people made "unsubscribe requests". How did they do that since the token isn't there?? Plus, their records aren't flagged with any red message, tho they do show up in Advanced Search. Did these people hit the spam button on their email programs? Will they get future emails? Am I supposed to do something with them? Thanks, in advance! Jim</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-13T15:14:39.173Z
Comments.Text: For what it's worth I have seen the exact same behavior (we have the same footer setup) in civiCRM 4.6.4 sending through Mandrill transactional emails. We have switched to SparkPost due to Mandrill going away and I will report back if we see the same behavior there.
Comments.UserDisplayName: Eli Lisseck
Tags: <civimail>
Title: CiviMail: Mystery Unsubscribes
ThreadText: # CiviMail: Mystery Unsubscribes
  
  (Asked by: username_0 on 2015-09-29)
  
  I just did our first email blast and it went pretty well. I'm using the token {action.optOutUrl} in the footer, plus the domain address, but that's it. The Opt Outs appear to have worked fine and they're labeled "No Bulk Emails (User Opt Out)" in the CiviCRM database. The bounces processed properly as well.
  
  The weird thing was that the Mail Report shows that 5 people made "unsubscribe requests". How did they do that since the token isn't there?? Plus, their records aren't flagged with any red message, tho they do show up in Advanced Search. Did these people hit the spam button on their email programs? Will they get future emails? Am I supposed to do something with them? Thanks, in advance! Jim
  
  **Tags:** civimail
  
  > **Comments:**
  > **username_1**: For what it's worth I have seen the exact same behavior (we have the same footer setup) in civiCRM 4.6.4 sending through Mandrill transactional emails. We have switched to SparkPost due to Mandrill going away and I will report back if we see the same behavior there.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_2 on 2016-11-14. Score: 8
  
  I had this question also and just figured it out!
  
  Civimail always includes a List-Unsubscribe header in the messages it sends out (<https://issues.civicrm.org/jira/browse/CRM-3251>).
  
  That header is invisible to most recipients and is intended as a way for mail clients to provide easy and standardized unsubscribe mechanisms (<http://www.list-unsubscribe.com/>).
  
  I note that google doesn't seem to do anything with it, though they do expose the list unsubscribe option for mailman lists, or used to .. But, it appears that Windows Live does use it, so anyone using that software that receives Civimail can use it.
  
  The only clue I had was in my apache logs - the time of the unsubscribe matched a soap request that came in via UAS/CiviSMTP that handles the bounces for this domain.
  
  Thanks to Leyla UAS/CiviSMTP support (<http://www.civismtp.com/>) for confirming this idea.
  
  For bonus points, assuming you really only want people to opt-out instead of unsubscribing, you can include this in a custom extension or module, changing 'hook' to the name of your custom extension or module.
  
  ```
  function hook_civicrm_alterMailParams(&$params, $context) {
    if ('civimail' == $context || 'flexmailer' == $context) {
      $params['List-Unsubscribe'] = str_replace('mailto:u.','mailto:o.',$params['List-Unsubscribe']);
    }
  }
  
  ```
  
  > **Comments:**
  > **username_2**: My solution recently stopped working when the client switched to using Mosaico - turns out the use of flexmailer caused this solution to stop working, so I've just updated it above. Updating from 4.6 to 4.7 didn't cause any issues.  
  
  ---
  
  ### Answer by username_3 on 2015-09-29. Score: 1
  
  I suspect that unsubscribes are a subset of opt out. So in CiviCRM, when a user opts out, they are also automatically unsubscribed from the mailing list groups you used.
  
  As opposed to those that might unsubscribe (if you had included that link) wherein they would be removed from the mailing list group they are in but would not have been opted out.
  
  > **Comments:**
  > **username_0**: Thanks for the quick reply! They don't seem to be a subset of the opt outs, since their records aren't flagged with any red messages. The mailing groups I used were temporary, so that's not gonna help. This seems like some kind of glitch. Should I assume they want off the list? So, I'll have to look for these after every mailing and opt them out manually? Bummer. I'm using 4.5.8 with WordPress. We tried 4.6.6, but CiviMail doesn't work with WP. You always get 0 recipients. We we had to backtrack..  
  > **username_0**: I guess I can find them with the advanced search, keep adding them to a permanent group and keep excluding that group from emails. What a pain! It's weird that you can't see this "unsubscribe request" flag when you look at their contact record.  
  > **username_3**: What are your outbound email settings?  
  > **username_0**: I'm using SMTP on DreamHost. On my mailing 92 people opted-out and only 5 people had this "unsubscribe request". Also, I was wondering if CiviMail captures anything when people hit the spam button? Any chance 5 people hit the spam button? Thanks again!  
  > **username_3**: No, the spam button is only generally with their ISP.  Too many spam button presses and the ISP just blocks your incoming mail.    Your prob is interesting.  Gotta think about it.  
  > **username_3**: Hmmm... do you have bounce processing set up?  
  > **username_0**: Oh, yeah. I had 863 bounces and as far as I can tell all those contact records got marked properly (on hold).  
  > **username_4**: Hmm, I've noticed some of this (Drupal 7, Civi 4.4) but haven't investigated it in much detail. AFAIK we only used the opt-out token too.  
  > **username_2**: This is not correct, unsubscribes are not a subset of opt-outs. There's a fair amount of confusion between the two and it's not a good idea to be confusing them further. Please edit your post.  
  
  ---
  
  ### Answer by username_5 on 2015-10-28. Score: 1
  
  It's weird indeed. Are you using an external provider to handle the mailings (eg mandrill or mailjet?) by any chance?
  
  Given the low number, I would suggest you to contact the 5 to tell them that you quite don't understand what happened with your mail server, if they could remember and explain you what they did to unsubscribe, it'd be super useful for you to understand their workflow.
  
  (be clear it's a personal email, not a mass mailing one and that you will remove them from the mailing list). I would send them from your mail client, not via civi
  
  Please update us on your finding.
  
  
  ---
  
  ### Answer by username_6 on 2020-02-20. Score: 0
  
  OK - I think I have this (thanks for input from @pradpnayak)
  
  according to the [docs for hook\_civicrm\_alterMailParams](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailParams/#adding-custom-headers-to-the-email):
  
  > You can add custom headers by appending to $params['headers']. Example:
  >
  > ```
  > $params['headers']['X-My-Header'] = 'my header value';
  >
  > ```
  >
  > The headers key may not exist in the $params array when passed into the hook.
  
  so this was the codce in an extension to unset the existing 'List-Unsubscribe', and put in a NULL replacement into the headers:
  
  ```
  
  /**
   * Implements hook_civicrm_alterMailParams().
   *
   * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
   */
  function custom_civicrm_alterMailParams(&$params, $context) {
    if ($context == 'flexmailer' || $context == 'civimail') {
      // remove existing header
      unset($params['List-Unsubscribe']);
      // replace via the 'headers' key
      $params['headers']['List-Unsubscribe'] = NULL;
    }
  }
  
  ```
  
  
  ---
  
  