简体   繁体   English

HTML MailTo是否实际发送电子邮件? 如果可以,怎么办?

[英]Does HTML MailTo actually send the e-mail? If so how?

So my question is when we use the following code: 所以我的问题是何时使用以下代码:

<!DOCTYPE html>
<html>
<body>

<h3>Send e-mail to someone@example.com:</h3>
<form action="MAILTO:someone@example.com" method="post" enctype="text/plain">
   Name:<br>
   <input type="text" name="name" value="your name"><br>
   E-mail:<br>
   <input type="text" name="mail" value="your email"><br>
   Comment:<br>
   <input type="text" name="comment" value="your comment" size="50"><br><br>
   <input type="submit" value="Send">
   <input type="reset" value="Reset">
</form>

</body>
</html>

What I'm asking is: 我要问的是:
does this actually send an email to someone@example.com? 这实际上是否将电子邮件发送到某人@ example.com? if so how? 如果是这样怎么办?

No, the browser fetches the default mail client. 否,浏览器将获取默认的邮件客户端。 It does not automatically send the e-mail, it simply shorthands the process of opening the mail client and putting certain values such as addresses in the header. 它不会自动发送电子邮件,它只是简化了打开邮件客户端并将某些值(例如地址)放入标头的过程。

No the browser is not capable of sending email. 没有浏览器不能够发送电子邮件。 Usually a server side language, like PHP or JAVA is used to send the email. 通常,服务器端语言(例如PHPJAVA )用于发送电子邮件。 You can find scripts where you can send the data to and it will send an email for you. 您可以找到可以将数据发送到的脚本,它将为您发送电子邮件。

Sending an email is a complicated task requiring ports to be open and certain headers to be sent with the message describing the To , From , Subject , Body , and more fields. 发送电子邮件是一项复杂的任务,需要打开ports ,并发送某些headers以及描述ToFromSubjectBody和更多字段的消息。

mailto is a browser shortcut to enable links to be opened in the default client, that the user chooses. mailto是浏览器快捷方式,用于使链接能够在用户选择的默认客户端中打开。

Here's how you can send email using a PHP Script . 这是使用PHP脚本发送电子邮件的方法。 If you do not have php on your server then you can not use this. 如果您的服务器上没有php,则不能使用它。

If you want to create an email template the mailto supports a few more parameters that can be passed along. 如果要创建电子邮件模板, mailto支持更多可以传递的参数。 Here's an example . 这是一个例子 If you use javascript you can have the user fill in the form, then when they click submit have it open an email, in their default client (including web emails), and have it prefilled for them to click send. 如果您使用javascript,则可以让用户填写表单,然后当他们单击“提交”时,将在其默认客户端(包括网络电子邮件)中打开一封电子邮件,并预先填写供用户单击“发送”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM