最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - is there a way to use HTML to send an email via gmail - Stack Overflow

programmeradmin1浏览0评论

The tag mailto: in a link opens the default email client. However, many of the people I want to code for use GMail.

So, is there a way to craft an email and access the user's gmail tab so that the all she/he has to do is to click send?

The tag mailto: in a link opens the default email client. However, many of the people I want to code for use GMail.

So, is there a way to craft an email and access the user's gmail tab so that the all she/he has to do is to click send?

Share Improve this question asked Aug 6, 2013 at 14:44 fiacobellifiacobelli 1,9905 gold badges24 silver badges31 bronze badges 4
  • 2 No ... Just no. Or you'll have to tell all your users to define gmail as their default client but this is not a html problem anymore ... – yent Commented Aug 6, 2013 at 14:45
  • 1 If they have Gmail set as their default client, mailto: will open a pose message browser window. – jalynn2 Commented Aug 6, 2013 at 14:46
  • 1 if this was possible, there'd be far more sites out there trying to send spam by auto-populating your gmail with garbage... so, no. – Marc B Commented Aug 6, 2013 at 14:47
  • In other words: This isn't something your code handles. It's something the end-user's puter configuration handles. Your job is to identify the link as an email address (which you've done). The rest is outside the scope of your code. – T.J. Crowder Commented Aug 6, 2013 at 14:50
Add a ment  | 

4 Answers 4

Reset to default 4

I am afraid that there isn't such way. It's not something that you should be attempting to solve in your web application because user agents might behave differently. So just leave it that way.

Use the anchor like that:

<a href="https://mail.google./mail/?view=cm&fs=1&[email protected]&su=subject_here&body=body_here"></a>

"Crafting an email and access the user's gmail tab" = XSS which is unethical.
One way to achieve what you want is to ask your users to make their Gmail handle mailto: links by following this guide -> https://support.google./mail/answer/10966?hl=en

No such way to set it from inside your applications. But gmail does provide you setting to open mailto links in gmail.

发布评论

评论列表(0)

  1. 暂无评论