• 
      

    Fix duplicate From headers in e-mails.

    Review Request #7588 — Created Aug. 14, 2015 and submitted

    Information

    Review Board
    release-2.0.x

    Reviewers

    A previous change to the mail header code resulted in the From header
    being included in e-mails twice, with different values. Gmail (and
    likely other mail systems) check for this, and will error out if they
    don't match.
    
    This was happening because we changed the mail header code to no longer
    pass any headers down to the EmailMessage constructor, opting instead to
    inject headers ourselves. This is fine, except we did this to the From
    header as well, which is considered special. The constructor needs to
    know about this one, and since we no longer provided it, it fell back to
    a default address. Our From header then got added later on, resulting in
    two different headers added.
    
    The solution is simple. We just make From special again, and pass its
    header down to the constructor.
    
    I've also renamed a member variable to help guard against any potential
    future changes to Django's EmailMessage class.
    
    Unit tests were added and updated to test for this.

    Unit tests passed.

    Viewed a copy of the sent e-mail in some manual testing. There was only
    one From header, and it had the correct value. Previously, I could see
    two conflicting values.

    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/notifications/email.py
          reviewboard/notifications/tests.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/notifications/email.py
          reviewboard/notifications/tests.py
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/notifications/email.py
          reviewboard/notifications/tests.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/notifications/email.py
          reviewboard/notifications/tests.py
      
      
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.5.x (de2f939)
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.0.x (de2f939)