Is there any code provided by google to forward mail. because i haven't found one. If there is any way to forward mail using GMAIL API with extra content to send with original message. Please help.
Asked
Active
Viewed 8,804 times
3 Answers
13
I don't see any specific forward
operation...
You'll have to:
get
the message,- add your extra content to the top of the original message and
- change the
to
address, then - remove any
cc
andbcc
addresses [Per @martin-paucot notes from his actual experience doing this] send
it.
Not much help to you but take note of the Threads.

John Mee
- 50,179
- 34
- 152
- 186
-
I have extracted multiparts from message and added new multipart in it with new content and now when i send the message it only shows new Content but message contains parts of previous message also can u tell me why ? and what is the solution of this? – Rider Jun 24 '15 at 05:23
-
Well that's a different question: you don't want to add a new multipart part to the message, just prepend some text to the existing message. You would do well to invest some more time researching the format of email messages. – John Mee Jun 24 '15 at 07:16
-
yes, i can prepend the text to existing message but if ihave to add new attachments to the same message then? – Rider Jun 24 '15 at 08:53
-
Then modify the message to include the attachment(s). – John Mee Jun 24 '15 at 10:57
-
@john - I have similar requirement. How did you solve it? Please share the references. – Rashmi Singh Nov 26 '19 at 08:09
-
Any updates? It would be great to use the "forward all" option through the API – dank Jul 23 '22 at 10:49
7
Watch out while doing this procedure !
I used the answer of Jhon Mee to forward all emails from a user to an other one. If you just change the "To:" it will continue to send the emails to everyone in "Cc:" and "Bcc:"
Here is the procedure:
- Retreive the email in raw format
- Decode the email from base64
- Replace the line "To:" with the email you want to forward to
- Remove the lines "CC:" and "Bcc:"
- Send it

Martin Paucot
- 1,191
- 14
- 30