从文本框ASP.NET填充Mailto [英] Populate Mailto from textbox ASP.NET

查看:83
本文介绍了从文本框ASP.NET填充Mailto的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框txtEmailAddress,该文本框是从数据库中填充的电子邮件地址.

然后,我有一个按钮btnSendEmail.

对我来说,获取按钮单击事件以构造mailto链接并打开它,而不是从当前页面导航到mailto链接的最佳方法是什么.

我在开发PC上的网上工作方式已经找到,但是当我在其他计算机上运行时,mailto链接填充在地址栏中(打开电子邮件客户端),但是IE却说无法从当前页面导航显示页面. ..

I have a text box txtEmailAddress which is populated from the database with an email address.

I then have a button btnSendEmail.

What is the best way for me to get the button click event to construct a mailto link and open it and not navigating away from the current page to the mailto link.

The ways I have found on the net work on my dev PC but when I run on other computers the mailto link gets populated in the address bar (email clients opens) but then IE says page cannot be displayed navigating away from the current page....

推荐答案

您在问题中有APS.NET标记.不要做任何您要问的事情.您的服务器端应解析POST并发送电子邮件;您的客户端只需要具有"POST" HTTP方法和所有输入控件形式的电子邮件数据(带有文件即可使用附件").最好在服务器端验证此数据.

警告!如果您不验证用户发布的数据或(仅重要的)仅在客户端进行验证,则任何人都可以轻松绕过此类验证并将您的服务器的主机转变为僵尸散布垃圾邮件之类的东西.做到这一点的技巧非常简单(如果您问我可以解释,但这很无聊).

—SA
You have APS.NET tag in the question. Don''t do anything you''re asking about. You server side should parse the POST and send e-mails; you client side need just e-mail data (with file(s) to use "attachments") in a form with the "POST" HTTP method and all the input controls. Validation of this data also best done in server side.

Warning! If you don''t validate user''s posted data or — important — validate it only on client side, anyone can easily bypass such validation and turn you server''s host computer into a zombie distributing spam of something like that. The tricks to do that are ridiculously simple (I can explain if you ask, but this is boring).

—SA


这是仅限IE的解决方案:
http://opensource.brightcove.com/project/JavaScript-MAPI-Wrapper/ [ ^ ]-我想这会有所帮助.

听起来好像您正在创建电子邮件客户端一样,但是还不清楚.

最好的问候
Espen Harlinn
This is an IE only solution:
http://opensource.brightcove.com/project/JavaScript-MAPI-Wrapper/[^] - I guess this will help.

It halfway sounds like you are creating an email client - but it''s not clear.

Best regards
Espen Harlinn


这篇关于从文本框ASP.NET填充Mailto的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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