如何使用JS发送带附件的邮件? [英] How to send mail with attachment using JS?
本文介绍了如何使用JS发送带附件的邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以告诉我如何使用JavaScript发送带附件的邮件吗?
Can anybody tell me how to send mail with an attachment using JavaScript?
推荐答案
您有两种发送电子邮件的方式:
You have two options to send email:
- 使用服务器端实现发送电子邮件,通过XMLHttpRequest在Javascript中访问
-
从JavaScript打开本地电子邮件客户端,用户可以使用预先填充的数据发送电子邮件。
- Use server side implementation to send email, access it in Javascript via XMLHttpRequest
Open the local email client from JavaScript and user can send email with pre-populated data.
var link = "mailto:target@example.com";
// In addition to this you can add subject or body as parameter .
// For e.g.
// "mailto:target@example.com?subject=test subject&body=my text"
window.location.href = link;
这篇关于如何使用JS发送带附件的邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文