Emails being sent periodically add snippets from the subject line into the header section of the email, which results in clients not being able to parse it correctly. Below is the raw email. Pay special attention to the header section where the "recovered - 199246" text is erroneously inserted.

      Delivered-To: foo@example.com
      Received: by 10.43.92.200 with SMTP id br8csp369415icc;
      Fri, 6 Sep 2013 12:17:36 -0700 (PDT)
      X-Received: by 10.194.120.68 with SMTP id la4mr3319022wjb.33.1378495055526;
      Fri, 06 Sep 2013 12:17:35 -0700 (PDT)
      Return-Path: <dev+bncBCG47CVXVEORBTWUVCIQKGQESDUNKQQ@example.com>
      Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70])
      by mx.google.com with ESMTPS id h7si1883897wja.53.1969.12.31.16.00.00
      (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
      Fri, 06 Sep 2013 12:17:35 -0700 (PDT)
      Received-SPF: pass (google.com: domain of dev+bncBCG47CVXVEORBTWUVCIQKGQESDUNKQQ@example.com designates 62.13.152.158 as permitted sender) client-ip=62.13.152.158;
      Authentication-Results: mx.google.com;
      spf=pass (google.com: domain of dev+bncBCG47CVXVEORBTWUVCIQKGQESDUNKQQ@example.com designates 62.13.152.158 as permitted sender) smtp.mail=dev+bncBCG47CVXVEORBTWUVCIQKGQESDUNKQQ@example.com
      Received: by mail-wg0-f70.google.com with SMTP id m14sf2919557wgh.5
      for <foo@example.com>; Fri, 06 Sep 2013 12:17:35 -0700 (PDT)
      X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
      d=1e100.net; s=20130820;
      h=mime-version:date:from:reply-to:to:cc:message-id:in-reply-to
      :references:subject:x-original-sender
      :x-original-authentication-results:precedence:mailing-list:list-id
      :list-post:list-help:list-archive:list-unsubscribe;
      bh=EQGcA0/+NH+FdTPtEmgeZSKOhJDn83vehY+qTMJqHis=;
      b=dIOII5x+cPqFj57LTVy3SggpHU8uVIQKtJR2cEjAcPMGJjvGp5wxaAxWXg2odgOGpZ
      HqDNdSd5HFwfQTKg9lo2ae1oI6r+7AItNMRMBbXqjEA3+/IIzhVwUFCuDLo3/fPrgL6b
      Pxo0q/Bg5ZgKhJshZXQ15EReOJSrXw9K/rZs+hOsU0qhkE3sRcMSbBxwG5vJ5WUkVVTP
      xnSXDPBFjZU8VEtml0uNl/UUx+DeBrghJnoWguQ8cfGk1TfMthsojyXoM8ZdxEpJpFmk
      1SvcSUTyDn7BfdMNAwipKXQNUgA6okXeYEnsqn/qtGPCURK8sGCt80lAqmKLfFV2yWFC
      lJmw==
      X-Received: by 10.180.208.35 with SMTP id mb3mr1414577wic.2.1378495054970;
      Fri, 06 Sep 2013 12:17:34 -0700 (PDT)
      X-BeenThere: dev@example.com
      Received: by 10.180.35.36 with SMTP id e4ls200918wij.29.canary; Fri, 06 Sep
      2013 12:17:34 -0700 (PDT)
      X-Received: by 10.180.83.229 with SMTP id t5mr1422321wiy.6.1378495054436;
      Fri, 06 Sep 2013 12:17:34 -0700 (PDT)
      MIME-Version: 1.0
      X-BeenThere: remote.jobs@example.com
      Received: by 10.180.35.36 with SMTP id e4ls200916wij.29.canary; Fri, 06 Sep
      2013 12:17:34 -0700 (PDT)
      X-Received: by 10.194.201.131 with SMTP id ka3mr3361737wjc.22.1378495054240;
      Fri, 06 Sep 2013 12:17:34 -0700 (PDT)
      Received: from outmail02478.authsmtp.com (outmail02478.authsmtp.com. [62.13.152.158])
      by mx.google.com with ESMTP id o8si1860959wjb.172.1969.12.31.16.00.00;
      Fri, 06 Sep 2013 12:17:34 -0700 (PDT)
      Received-SPF: pass (google.com: domain of jenkins@example.com designates 62.13.152.158 as permitted sender) client-ip=62.13.152.158;
      Received: from punt9.authsmtp.com (punt9.authsmtp.com [62.13.128.70])
      by punt10.authsmtp.com (8.14.2/8.14.2) with ESMTP id r86JHXrD037613;
      Fri, 6 Sep 2013 20:17:33 +0100 (BST)
      Received: from mail-c237.authsmtp.com (mail-c237.authsmtp.com [62.13.128.237])
      by punt9.authsmtp.com (8.14.2/8.14.2) with ESMTP id r86JHXXT022328;
      Fri, 6 Sep 2013 20:17:33 +0100 (BST)
      Received: from www.example.com (li370-40.members.linode.com [96.126.121.40])
      (authenticated bits=0)
      by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id r86JHV5B060885;
      Fri, 6 Sep 2013 20:17:31 +0100 (BST)
      Received: from hera.evoworx.org (localhost [127.0.0.1])
      by www.example.com (Postfix) with ESMTP id EC731280C8;
      Fri, 6 Sep 2013 19:17:30 +0000 (UTC)
      Date: Fri, 6 Sep 2013 19:17:30 +0000 (UTC)
      From: jenkins@example.com
      Reply-To: remote.jobs@example.com
      To: remote.jobs@example.com
      Cc: will@example.com
      Message-ID: <3775861.74.1378495050960.JavaMail.jenkins@hera>
      In-Reply-To: <12592623.69.1378495015327.JavaMail.jenkins@hera>
      References: <12592623.69.1378495015327.JavaMail.jenkins@hera>
      Subject: [prod]jobname
      X-Server-Quench: fa6ae432-1728-11e3-94fa-002590a135d3
      X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse
      X-AuthRoute: OCd3aAsdA1ZXQQIZ CyUfSi9NUwwNKxtB GxASNgJEPktPXgNU JENHKkZSKFkRBQoY TWYNRDcBEEJzWWJ2 ewhRZwRaaElPEQxs TklLRExTFgR2BRwe BBsBUlcwfwM8ABh1 F0ZkXnhTWQp5cUN+ DBgFEzxTYWRidWEY UkhFdgIBcx5DekkU d1B/VnYEYTQGZX80 RBkAJyo2MQBsIThJ TwQVMWUXTF0QFzEx cBwPGTQxEFcESj4E NwYrNF8RA3NZNFQp PEEtUGUAKRIMCwBB dwAA
      X-Authentic-SMTP: 61633438333830.1024:706
      X-AuthFastPath: 0 (Was 255)
      X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system.
      X-Original-Sender: jenkins@example.com
      X-Original-Authentication-Results: mx.google.com; spf=pass (google.com:
      domain of jenkins@example.com designates 62.13.152.158 as permitted
      sender) smtp.mail=jenkins@example.com
      Precedence: list
      Mailing-list: list dev@example.com; contact dev+owners@example.com
      List-ID: <dev.example.com>
      X-Google-Group-Id: 1054845177137
      List-Post: <http://groups.google.com/a/example.com/group/dev/post>, <dev@example.com>
      List-Help: <http://support.google.com/a/example.com/bin/topic.py?topic=25838>,
      <dev+help@example.com>
      List-Archive: <http://groups.google.com/a/example.com/group/dev/>
      List-Unsubscribe: <http://groups.google.com/a/example.com/group/dev/subscribe>,
      <googlegroups-manage+1054845177137+unsubscribe@googlegroups.com>

      recovered

      • 199246
        MIME-Version: 1.0
        Content-Type: multipart/mixed;
        boundary="----=_Part_72_31250540.1378495050639"
        X-Jenkins-Job: job-name
        X-Jenkins-Result: SUCCESS
        List-ID: "Remote Jobs" <remote.jobs.example.com>
        Precedence: bulk

      ------=_Part_72_31250540.1378495050639
      Content-Type: text/plain; charset=UTF-8
      Content-Transfer-Encoding: 7bit

      OUR EMAIL CONTENT

      -----=_Part_72_31250540.1378495050639-

          [JENKINS-19520] Periodic subject line content in email headers

          Alex Earl added a comment -

          Can you highlight what exactly I should be looking for? There is a lot of stuff there.

          Alex Earl added a comment - Can you highlight what exactly I should be looking for? There is a lot of stuff there.

          The text "\n\n recovered\n -199246\n" is being injected in the middle of the headers (about 10 lines up from the bottom of the header). The "\n\n" causes mail clients to assume that that's the end of the headers - but even if the "\n\n" wasn't there, I'm not sure why the recovered text should show up.

          Leo Shklovskii added a comment - The text "\n\n recovered\n -199246\n" is being injected in the middle of the headers (about 10 lines up from the bottom of the header). The "\n\n" causes mail clients to assume that that's the end of the headers - but even if the "\n\n" wasn't there, I'm not sure why the recovered text should show up.

          Alex Earl added a comment -

          Where is that coming from? What tokens are you using that would create something like "\n\nrecovered-199246\n". You can enable JavaMail debug and determine exactly what is being sent by email-ext.

          Alex Earl added a comment - Where is that coming from? What tokens are you using that would create something like "\n\nrecovered-199246\n". You can enable JavaMail debug and determine exactly what is being sent by email-ext.

          Brett Clouser added a comment -

          We're using custom Groovy templates for formatting the subject line of our email. The "recovered - 199246" text is coming from these templates. It looks like we were adding a new line to the end of each of these templates, so that might be the source of the extraneous "\n" characters. I'm testing out this theory to see if the issue reproduces anymore.

          Brett Clouser added a comment - We're using custom Groovy templates for formatting the subject line of our email. The "recovered - 199246" text is coming from these templates. It looks like we were adding a new line to the end of each of these templates, so that might be the source of the extraneous "\n" characters. I'm testing out this theory to see if the issue reproduces anymore.

          Alex Earl added a comment -

          Great, let me know if its still an issue.

          Alex Earl added a comment - Great, let me know if its still an issue.

          Alex Earl added a comment -

          Can this be closed out?

          Alex Earl added a comment - Can this be closed out?

          Brett Clouser added a comment -

          We haven't seen the problem since, so I'm assuming it's the newline issue. Thanks!

          Brett Clouser added a comment - We haven't seen the problem since, so I'm assuming it's the newline issue. Thanks!

          Alex Earl added a comment -

          Submitter had an extra newline at the end of a script that was generating subject information.

          Alex Earl added a comment - Submitter had an extra newline at the end of a script that was generating subject information.

            slide_o_mix Alex Earl
            brettcl Brett Clouser
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: