title: How to forward email to another address with sendEmail(to,replyTo, subject, body)
body: <p>I appreciate if you could help.</p>
  
  <p>I need to find all unread emails in my gmail 1@example.com and send them all to 2@example.com by using sendEmail(to,replyTo, subject, body) <a href="https://developers.google.com/apps-script/reference/mail/mail-app" rel="nofollow noreferrer">https://developers.google.com/apps-script/reference/mail/mail-app</a></p>
  
  <p>I tried to write a script but unfortinately it does not want work.
  I hope you could help</p>
  
  <pre><code>function RespondEmail(e) {
  
  //send response email
  var threads = GmailApp.search("to:(1@example.com) label:unread");
  for (var i = 0; i &lt; threads.length; i++) {
  threads[i].sendEmail("1@example.com",
                 "2@example.com",
                 "TPS report status",
                 "What is the status of those TPS reports?")}
  
  
  // mark all as read
  var threads = GmailApp.search("to:(1@example.com) label:unread");
  GmailApp.markThreadsRead(threads);
  }
  </code></pre>
  
  <p>I also would be happy if you could advise me how I can change the subject of the ReplyTo email according  to original email which I receive on 1@example.com</p>