通过html发送附带附件的电子邮件(send an email with attached file via html)

编程入门 行业动态 更新时间:2024-10-20 13:39:46
通过html发送附带附件的电子邮件(send an email with attached file via html)

我想用html发送带附件的电子邮件,我可以这样做(因为我没有服务器只是静态的)?

我想上传文件并通过电子邮件发送它不存储它,下面的代码将文件存储在磁盘上是否可以通过邮件发送?

<form action="fileinsert.html" method="post"> <p> Enter Your Text :<br> <input type="text" name="textwrite" size="15"> </p> <p> Specify your File:<br> <input type="file" name="datasize" size="30"> </p> <div> <input type="submit" value="Send"> </div> </form>

这只是html的可行吗?

I want to send an e-mail with attachment using just html ,can I do that(because I dont have a server just static)?

I want to upload the file and e-mail it not store it, the code below store the file on disk is it possible to send it via mail?

<form action="fileinsert.html" method="post"> <p> Enter Your Text :<br> <input type="text" name="textwrite" size="15"> </p> <p> Specify your File:<br> <input type="file" name="datasize" size="30"> </p> <div> <input type="submit" value="Send"> </div> </form>

is this doable with just html?

最满意答案

不,你不能用纯HTML做到这一点。

要发送电子邮件,您需要在服务器上使用PHP脚本,该脚本从表单中收集数据并发送:

<?php mail($_POST['to'], $ubject, $message); ?>

这只是如何使用邮件功能而不是功能代码片段的一个小例子,有关详细信息,请参阅mail()函数

你也应该看一下Mail_Mime 。

正如Chris Peter所说,有多种方法可以做到:你可以使用Ruby,Perl,Python,.NET甚至C来完成这项任务。

No, you can't do this with pure HTML.

To send E-Mails you need a PHP-Script on the server which collects the data from your form and send it:

<?php mail($_POST['to'], $ubject, $message); ?>

This is just a little example of how using the mail-function and not a functional snippet for your problem, see for more information see mail() function

You also should have a look at Mail_Mime.

As Chris Peter says there is more than one way to do it: You can use Ruby, Perl, Python, .NET and even C for accomplishing this task.

更多推荐

本文发布于:2023-08-02 19:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1379586.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:附件   电子邮件   html   send   file

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!