title: Mail gem. Extract recipient display name and address as separate values
body: <p>Using the Mail gem (i.e. Rails + ActionMailer), is there a clean way to get the display name of the recipient?</p>
  
  <p>I can get the address with:</p>
  
  <pre><code>mail.to.first
  </code></pre>
  
  <p>And I can get the formatted display name + address with:</p>
  
  <pre><code>mail.header_fields.select{ |f| f.name == "To" }.first.to_s
  </code></pre>
  
  <p>But how can I get just the display name part (i.e. before the <code>&lt;</code> and <code>&gt;</code>).  I know somebody is going to suggest a Regex, but that's not what I'm looking for, since I'd then have to parse out any encoding, which is something the Mail gem probably already does.  I'm the author of a popular Mailer library in PHP and am aware of the pitfalls of just assuming the bit before <code>&lt;</code> and <code>&gt;</code> is human-readable, in the headers, when 8-bit characters come into play.</p>
  
  <p>I can do this:</p>
  
  <pre><code>mail.header_fields.select{ |f| f.name == "To" }.first.parse.individual_recipients.first.display_name.text_value
  </code></pre>
  
  <p>But there must be a better way? :)</p>