Edit or forward an existing mail into Gmail Compos

2019-05-29 03:34发布

问题:

I have a Chrome extension which adds new functionalities to the Gmail interface.

I'm trying to create email "templates" which have a default header, footer and signature (using html, images & css). I want to open these templates in order to edit and send them, just filling the actual content of the email.

I was wondering if there is any way to open these emails directly into the Gmail Compose Window or something like that. Maybe there is a parameter to do this using the URL, like: https://mail.google.com/mail/?view=cm&fs=1&id=xxxxxxx.

I've tried loading the template using the body parameter, but it seems that it doesn't support html.

Any ideas?

回答1:

Finally, I've found a way to open a mail directly into the "Compose" Window, ready to be edited and sent. It's so simple that I can not believe it takes me 2 days to figure it out:

Just use the url:

https://mail.google.com/mail/u/[accountNumber]/?zx=#[tag]?compose=[MailID]

  • accountNumber is useful if you have two or more accounts at the same time
  • tag its the mail list that you want to see behind the compose window (ussually inbox).
  • MailId ... well, the Gmail Message ID.

For instance, https://mail.google.com/mail/u/0/?zx=#inbox?compose=14bbb0dae14fec1f will open the inbox of your first account with a Compose Window opened and pre-populated with the e-mail data.



回答2:

There is already a feature called "canned Response" in current gmail compose window which is probably solving the same problem that you are trying to solve with your extension. well I am not sure URL has html support or not but I think it should not support it to protect user from cross-site scripting attacks. you can also consider Gmail rest API if you want to compose gmail message with your own custom template but using this you may have to do lots of things from scratch.