email forwarding removes original sender's email address in Google app scripts

岁酱吖の 提交于 2020-01-15 07:27:08

问题


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.



来源:https://stackoverflow.com/questions/10876644/email-forwarding-removes-original-senders-email-address-in-google-app-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!