title: Google Script - forwarding mail
body: <p>Can I ask you for advice. I have a Google script that does this:
  1) check whether there is any conversation marked by an asterisk
  2) if so, deselect it, and then forward this conversation to that address</p>
  
  <p>It works well, but I need to easily pimp. Rather than forward, I need to send the message to the address, which would be the subject of a report and found the body of a message by message body was found under the link to the thread found messages and the icing on the cake would have been references to attachments in the message.</p>
  
  <pre><code>    function TJ() {
    var threads = GmailApp.search('is:starred');
    for (var h = 0; h &lt; threads.length; h++) {
      var messages = threads[h].getMessages();
      for (var i = 0; i &lt; messages.length; i++) {
        if (messages[i].isStarred())
        {
          Logger.log(messages[i].getSubject());
          messages[i].unstar();
          messages[i].forward("--email-address--", {
            cc: "",
            bcc: ""
            });     
        }
    }
  }
  }
  </code></pre>
  
  <p>THX!</p>