如何使用电子邮件表单发送电子邮件和启动文件下载 [英] How to have email form send email and start file download

查看:90
本文介绍了如何使用电子邮件表单发送电子邮件和启动文件下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上周经过多次搜索后,我在这个新闻组的

找到了问题的答案。我找不到我解决方案的主题,

但我想报告哪些有用。


当网站访问者填写时表单并提交它,这称为

而不是普通的asp脚本,如formmail.asp发送电子邮件和

显示谢谢网页。在我的谢谢你的最后网页

页面我放置了以下内容:


< script type =" text / javascript">

location。 href =" FileToDownload.exe"

< / script>


这导致文件下载被触发,并询问用户是否

他们想要保存文件。在有限的测试中,这似乎在Firefox和IE中都可以正常工作。


干杯,


Brian Murphy

德克萨斯州奥斯汀

Last week after much searching, I found the answer to my problem in
this newsgroup. I can''t find the thread from which I got my solution,
but I wanted to report back what worked.

When the site visitor fills out the form and submits it, this calls a
rather ordinary asp script like formmail.asp that sends the emails and
displays a "thank you" web page. At the very end of my "thank you" web
page I placed the following:

<script type="text/javascript">
location.href="FileToDownload.exe"
</script>

This causes the file download to get triggered, and asks the user if
they want to save the file. In limited testing this appears to work
fine in both Firefox and IE.

Cheers,

Brian Murphy
Austin, Texas

推荐答案

bm ***** @ xlrotor.com 写道:
bm*****@xlrotor.com wrote:
[...]
当网站访问者填写表格时并提交它,这称为一个非常普通的asp脚本,如formmail.asp,它发送电子邮件并显示谢谢。网页。在我的谢谢你的最后web
页面我放置了以下内容:

< script type =" text / javascript">
location.href =" FileToDownload.exe"
< / script>

这会导致文件下载被触发,并询问用户是否要保存文件。在有限的测试中,这似乎在Firefox和IE中都很好用。
[...]
When the site visitor fills out the form and submits it, this calls a
rather ordinary asp script like formmail.asp that sends the emails and
displays a "thank you" web page. At the very end of my "thank you" web
page I placed the following:

<script type="text/javascript">
location.href="FileToDownload.exe"
</script>

This causes the file download to get triggered, and asks the user if
they want to save the file. In limited testing this appears to work
fine in both Firefox and IE.




当且仅当所需的客户端脚本和DOM支持

存在。做这个服务器端你好多了。在

最少提供服务器端后备。

PointedEars

-

一个人可以发明另一个人可以发现。

- Sherlock Holmes在Sir Arthur Conan Doyle的'

" The Dancing of the Dancing Men'



If, and only if, the required client-side script and DOM support
is present. You are much better off doing this server-side. At
least provide a server-side fallback.
PointedEars
--
What one man can invent another can discover.
-- Sherlock Holmes in Sir Arthur Conan Doyle''s
"The Adventure of the Dancing Men"


bm*****@xlrotor.com 写道:
bm*****@xlrotor.com wrote:
上周经过多次搜索,我在这个新闻组中找到了我的问题的答案。我找不到我得到解决方案的帖子,
但是我想报告哪些有用。

当网站访问者填写表格并提交时,这个电话一个相当普通的asp脚本,比如formmail.asp发送电子邮件,
显示谢谢。网页。在我的谢谢你的最后web
页面我放置了以下内容:

< script type =" text / javascript">
location.href =" FileToDownload.exe"
< / script>
Last week after much searching, I found the answer to my problem in
this newsgroup. I can''t find the thread from which I got my solution,
but I wanted to report back what worked.

When the site visitor fills out the form and submits it, this calls a
rather ordinary asp script like formmail.asp that sends the emails and
displays a "thank you" web page. At the very end of my "thank you" web
page I placed the following:

<script type="text/javascript">
location.href="FileToDownload.exe"
</script>




此代码在Firefox中运行不佳 - 该文件确实提供了

下载确实,但是谢谢你文字没有显示(FF 1.0.4。

WinXP SP2)。


我建议不要使用太多异国情调的人造建筑喜欢

那个。


为什么不直接使用:


< p>谢谢。该表单已发送< / p>

< p>< a href =" FileToDownload.exe">点击此处

下载.exe-文件< / a>< / p>





< p>谢谢。表单已发送。< / p>

< iframe width =" 0"高度= QUOT; 0" src =" FileToDownload.exe"

style =" visibility:hidden;显示:无;宽度:0像素;身高:0px">

< / iframe>


-

巴特



This code doesn''t work well in Firefox - the file is offered for
download indeed, but the "Thank you" text doesn''t display (FF 1.0.4. on
WinXP SP2).

I''ld suggest not to use too much exotic artificial constructions like
that.

Why not just use:

<p>Thank you. The form has been sent</p>
<p><a href="FileToDownload.exe">Click here to
download the .exe-file</a></p>

Or

<p>Thank you. The form has been sent.</p>
<iframe width="0" height="0" src="FileToDownload.exe"
style="visibility:hidden; display:none; width:0px; height:0px">
</iframe>

--
Bart


我不得不承认我无法区分

是客户端和服务器端的东西。


多年来我的谢谢你页面有一个点击这里,如果下载

没有自动启动链接类型。这是必要的,因为

下载永远不会自动启动。


关于三行jave最让我感兴趣的两件事

脚本是1)当我在FF和IE中测试它时它工作,2)它只是

三行脚本。


原谅我的无知,但这种做法是什么让它变得异乎寻常和人为的?


当时我找到了我认为的东西伟大,简单而优雅的3行

解决方案,其他人试图帮助我解决这个问题,通过

在我的网页上添加难以理解的(对我而言)脚本。


Brian

I''ll have to confess I can''t tell the difference between something that
is client-side and server-side.

For years my "thank you" page has had a "Click here if the download
doesn''t start automatically" type of link. That was necessary because
the download never did start automatically.

The two things that appeal to me the most about the three lines of jave
script are 1) it worked when I tested it in FF and IE, and 2) it''s only
three lines of script.

Forgive my ignorance, but what is it about this approach that makes it
seem exotic and artificial?

At the time I found what I consider a great, simple and elegant 3 line
solution, someone else was trying to help me solve this problem by
adding mountains of indecipherable (to me) script to my web page.

Brian


这篇关于如何使用电子邮件表单发送电子邮件和启动文件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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