email forwarding removes original sender's ema

2019-07-16 11:49发布

问题:

Here's my Google App Script code:

var messages = threads[x].getMessages();
for (var y in messages) 
{
  messages[y].forward("someone@example.com");
}

This forwards fine, but it resets the from field of message to the email id of account which executes the script. This removes all credentials of the original sender of message. How to forward the email more elegantly such that all original headers (at least from and to) are retained? If the original message was sent to a list of people or a newsgroup, I need to retain it in the forwarded message.

回答1:

In general a forwarded email does not retain the original from and to address. If you forward an email using GMail or Outlook you'll notice this. The GMailApp is behaving the same way.