我们如何通过Java脚本发送电子邮件. [英] how can we send email by java script.

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

问题描述

我们如何通过Java脚本发送电子邮件.

how can we send email by java script.

推荐答案

JavaScript不能直接发送电子邮件(出于安全原因,否则您访问的每个页面都会自行发送电子邮件一封电子邮件以获取您的电子邮件地址),但是您可以打开用户的邮件客户端:
Javascript can''t send email directly (for security reasons, or every page you visited would send itself an email to get your email address), but you can either open the users mail client:
window.open('mailto:WebMaster@MySite.com');

或您可以使用按钮通过背后的代码从服务器上的电子邮件主机发送邮件.

Or you can use a button to send the mail from your email host on the server via the codebehind.




要发送电子邮件,您需要在自己的侧面配置SMTP服务器.
Javascript是在客户端执行的,因此没有直接的方法可以使用JavaScript发送电子邮件,但是可以使用替代解决方案.

1)您可以使用ajax调用将有关数据的电子邮件发送到服务器端页面,并且该页面将发送电子邮件.

2)或者您可以开发用于发送可通过javascript(ajax)代码调用的电子邮件的Web服务


for sending email you require SMTP server configured on your side.
Javascript is execute at client side so there is no direct way to send an email using JavaScript but the alternate solution can be.

1) you can use ajax call that will send email regarding data to your server side page and that will page will send an email.

2)Or you can develop a web service for sending email that can be invoke via your javascript(ajax) code


这篇关于我们如何通过Java脚本发送电子邮件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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