title: Gnus: How to archive emails according to the account they were written from? [gcc-self not working as expected]
body: <p>I have two mail accounts, <code>foo.bar@uni.edu</code> and <code>foo.bar@gmail.com</code>. I would like to archive messages I send from either one in a corresponding "sent mail" folder (<code>nnimap+foo.bar@uni.edu:Sent Items</code> and <code>foo.bar@gmail.com:[Google Mail]/Sent Mail</code>).</p>
  
  <p>I tried to set</p>
  
  <pre><code>(setq gnus-message-archive-group
    '(("uni" "nnimap+foo.bar@uni.edu:Sent Items")
      ("gmail" "nnimap+foo.bar@gmail.com:[Google Mail]/Sent Mail")
      ))
  </code></pre>
  
  <p>but that does not set Gcc (new messages don't have a Gcc; any solution here?). I thus went back to <code>(setq
  gnus-message-archive-group "nnimap+foo.bar@uni.edu:Sent Items")</code> which sets Gcc
  correctly (for the main account <code>foo.bar@uni.edu</code>) if I open a new message in *Group* via <code>m</code>.</p>
  
  <p>I then tried to use <code>gcc-self</code> via <code>gnus-parameters</code> to archive the sent mails correctly:</p>
  
  <pre><code>(setq gnus-parameters
         `((,(rx "nnimap+foo.bar@uni.edu")
           (gcc-self . "nnimap+foo.bar@uni.edu:Sent Items"))
           (,(rx "nnimap+foo.bar@gmail.com")
           (gcc-self . "foo.bar@gmail.com:[Google Mail]/Sent Mail"))))
  </code></pre>
  
  <p>The manual (<a href="http://www.gnus.org/manual/gnus_28.html" rel="noreferrer">http://www.gnus.org/manual/gnus_28.html</a>) says that if <code>gcc-self</code> is
  a string, it is simply inserted literally as Gcc header. I made the following
  experience: Wherever I start a new message in *Group* via <code>C-u m</code> (with <code>m</code>, Gcc
  is "nnimap+foo.bar@uni.edu:Sent Items" as mentioned before), Gcc is taken to be
  the name the point was on in *Group* before <code>m</code> was hit. So if the point is on
  <code>nnimap+foo.bar@gmail.com:Drafts</code>, Gcc will be <code>Gcc:
  nnimap+foo.bar@gmail.com:Drafts</code> (instead of <code>foo.bar@gmail.com:[Google
  Mail]/Sent Mail</code>). How can this be fixed and messages archived in the corresponding sent mail folders if written via <code>C-u m</code>? In other words, why are the <code>Gcc</code>'s not set correctly?</p>
  
  <p>[this is on Emacs 24.3.50.1, Gnus v5.13]</p>