联系表格发送电子邮件. [英] contact form send email.

查看:97
本文介绍了联系表格发送电子邮件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有联系表.我写了以下代码


I have contact form on my website. I have written following code


<form method="post"  action="mailto:sonalipatil311@rediffmail.com" enctype="text/plain">

</form>


在该代码中,我有3个文本框(名称,电子邮件,注释)
一键提交邮件.它可以在IE中正常工作,但不能在google crome中工作.为什么?


inside that code I have 3 text boxes (name,email, comment)
one button for submit the mail. Its working fine in IE but not working in google crome. why?

推荐答案

整个想法是错误的.此代码示例中没有任何工作.也许您没有显示代码的相关部分.

如果您使用表单发布邮件,则无需公开收件人"电子邮件地址.实际上,隐藏该电子邮件地址甚至发送消息的整个机制是在服务器端发送消息的重要目的之一.与服务器端打交道的主要考虑因素是安全性考虑.否则,您可以像这样简单地创建一个锚点:
The whole idea is wrong. There is nothing to work in this code sample. Perhaps you did not show relevant part of the code.

If you are using a form to post a mail message, you never need to expose the "To" e-mail address. Actually, hiding that e-mail address and even the whole mechanism of sending a message is one of the important purposes of sending a message on the server side. Main considerations of dealing with the server side are safety consideration. Otherwise, you could simply create an anchor like this:
<a href="mailto:mailto:sonalipatil311@rediffmail.com">Send me a message</a>

请注意,在这种情况下,您始终向所有人公开您的电子邮件地址,就像任何URI一样在HTML页面上.

我希望您理解<form>标记仅在服务器端有需要时才需要.如果您不使用任何服务器端技术,那么您的活动将毫无意义.您只能使用上面显示的锚点,该锚点可能会在用户的计算机上运行某些默认的邮件程序.不能保证用户安装了类似的东西,也不能保证用户可以使用可使用任何Web浏览器从网页复制的电子邮件地址.如果我假设您使用某些服务器端技术,那么由于您没有与我们分享您正在使用的确切内容,因此我无法提供详细的建议.

使用服务器端是组织站点用户发送安全邮件的方法.属性action的值应该是某个Web页面的URL,通常与表单页面位于同一页面.消息所需的数据(例如消息,主题,附件"数据,用户信息等)应放置在表单中,并使用唯一的name属性进行标识.服务器端代码应通过其name属性识别每条数据,编写一条消息并将其发送.

这是给您的严重安全警告:过滤用户提供的所有数据以确保安全至关重要,这一点至关重要.如果您不这样做,您的主机可能会立即变成僵尸,发送垃圾邮件或类似内容.在过去的回答中,我将详细解释此问题.请参阅:
无法发送邮件,它显示了以下代码中的错误. [

Note that in this case you always expose your e-mail address to everyone, as with any URI on the HTML page.

I hope you understand that the <form> tag is only needed if you something on the server side. If you don''t use any server-side technology, your activity makes no sense. You can only use an anchor shown above which might run some default mail program on the user''s machine. Nothing guarantees that the user has anything like that installed and that the user is able to use the e-mail address which can be copied from the Web pages using any Web browser. If I assume you use some server-side technology, I cannot do give a detailed advice as you did not share with us what exactly are you using.

Using server side is the way to organize safe message sending by the site users. The value of the attribute action should be an URL of some Web page, usually the same page as the one with the form. The data required for the message (such as message, subject, "attachment" data, user information, etc) should be placed in the form and identified with unique name attribute. The server-side code should identify each piece of data by its name attribute, compose a message and send it.

Here is a serious safety warning for you: it is critically important that you filter all the user-supplied data to make sure it is safe. If you fail to do it, your host can be turned zombie sending spam or something like that in no time. In my past answer, I explain this issue in detail. Please see:
unable to send mail , it showing the error in below code .[^].

Please be very careful.

Good luck,

—SA


这篇关于联系表格发送电子邮件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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