Create a Gmail share link

冷暖自知 提交于 2020-06-08 13:20:53

问题


I would like to put a button on my one page web application that allows a user to send a link through Gmail. I found that some websites such as addthis.com provide such a button, however this button automatically uses the link from the url bar. Since I have a one page web application the link in the url bar will always be the same. I need to be able to to put the link in the button myself (which is possible with, for example, the Facebook and Twitter share buttons).

How can I create a Gmail button that can be used to share a link?

Thank you.


回答1:


On Button click write a function and do this inside the function

let url = 'https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=&su=Your+Subject+here&body='+msgbody+'&ui=2&tf=1&pli=1';

window.open(url, 'sharer', 'toolbar=0,status=0,width=648,height=395');

The url will generate a link to open a gmail tab with auto filled subject and in in place of msgbody you can put your url you want to share.




回答2:


Try the official Google+ Share button. There's a field there where you'll specify the "URL to share". Since you're only using one URL, this might work in your favor.




回答3:


Gmail Sharable Link Creator

Site Link: GmailLink.GitHub.io

Steps to Follow to generate the Link

  1. Get the Message ID Of Mail Thread (Mail > 3 dot menu in Right side (⋮) > Click on Show Original > See the MessageID).

  2. Copy the Message-Id

  3. Use the MessageId & click On Submit to generate the Mail Sharable Link.



来源:https://stackoverflow.com/questions/44423797/create-a-gmail-share-link

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