如何使用javascript或jquery发送电子邮件 [英] How to send email by using javascript or jquery

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

问题描述

我为博客开发了一个网络表单,我需要将其值发送到电子邮件。

I developed a web-form for a blog, and I need to send its values to an email.

如何使用jQuery或JavaScript发送电子邮件单独?

How can I send an email by using jQuery or JavaScript alone?

推荐答案

简短的回答是你无法单独使用JavaScript。您需要一个服务器端处理程序来连接SMTP服务器以实际发送邮件。网上有很多简单的邮件脚本,例如PHP的这个:

The short answer is that you can't do it using JavaScript alone. You'd need a server-side handler to connect with the SMTP server to actually send the mail. There are many simple mail scripts online, such as this one for PHP:

简单的PHP邮件脚本

使用这样的脚本,您可以将Web表单的内容发布到脚本中,使用这样的函数:

Using a script like that, you'd POST the contents of your web form to the script, using a function like this:

jQuery。发布

然后脚本将获取这些值,加上邮件服务器的用户名和密码,并连接到服务器以发送邮件。

And then the script would take those values, plus a username and password for the mail server, and connect to the server to send the mail.

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

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