如何在HTML中单击提交按钮时直接发送电子邮件而不打开Outlook? [英] How to send email directly without opening the outlook when clicking submit button in HTML?

查看:348
本文介绍了如何在HTML中单击提交按钮时直接发送电子邮件而不打开Outlook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在提交按钮被点击时发送电子邮件。我会提到以多种方式发送邮件,但代码只打开Outlook而不是用HTML发送直接电子邮件



我尝试了什么:



我尝试了太多方法,但那不起作用Pls任何人都可以帮助我?

I need to send email when submit button is Clicked.I'd refered to send mail in many ways but the codes are only opens the outlook not sending direct email in HTML

What I have tried:

I tried too many ways but that was not working Pls Anyone can help me?

推荐答案

这个一样[ ^ ]?


HTML不能这样做 - 它在客户端上运行,因此它必须访问客户端资源才能发送电子邮件。这意味着HTML电子邮件请求必须使用客户端电子邮件应用程序来生成电子邮件 - 如果您考虑它,这很有意义,除非您希望随机网站在您不知情的情况下以您的名义发送电子邮件! />


在不打开客户端电子邮件应用程序的情况下发送电子邮件的唯一方法是使用服务器电子邮件ID和服务器代码从服务器发送电子邮件。具体如何操作将取决于您编写服务器端代码的语言:例如C#,VB或PHP。

快速谷歌会找到从服务器发送电子邮件的示例,如果你包括你选择的语言。
HTML can't do that - it runs on the client, so it has to access client resources in order to send an email. That means that an HTML email request has to use the client email app to generate the email - and if you think about it, that makes a lot of sense, unless you want random websites sending out emails in your name without your knowledge!

The only way to send an email without opening the client email app is to send it from the server, using server email ids and server code. Exactly how you do that will depend on the language you wrote your server side code in: C#, VB, or PHP for example.
A quick google will find you examples of sending emails from the server, if you include your chosen language.


Quote:

我需要在点击提交按钮时发送电子邮件。

I need to send email when submit button is Clicked.



基本上有两种解决方案:

- 在客户端:使用像< a href =mailto:someone@example.com这样的链接?主题=你好>发送邮件< / a>

该链接在客户端打开一个新邮件,但是发送或不发送邮件是客户端的选择,它也包含。

- 在服务器端:就像在解决方案1中一样,你必须在服务器上调用一些能够完成这项工作的代码。


There is basically 2 solutions:
- On client side: By using a link like <a href="mailto:someone@example.com?Subject=Hello">Send Mail</a>
The link opens a new mail on client side, but sending the mail or not is a client choice, its contain too.
- On server side: Just like in solution 1, you must call some code on server which will do the job.


这篇关于如何在HTML中单击提交按钮时直接发送电子邮件而不打开Outlook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆