简体   繁体   English

从 HTML/CSS/JS 应用程序发送电子邮件

[英]send an email from a HTML/CSS/JS app

I am developping a mobile HTML/CSS/JS app with a contact form.我正在开发一个带有联系表格的移动 HTML/CSS/JS 应用程序。 For now I use a "mailto" to send the message, but it is not efficient because the user is sent to his email app before sending.现在我使用“mailto”来发送消息,但效率不高,因为用户在发送之前被发送到他的电子邮件应用程序。 How can I send the message directly from the app ?如何直接从应用程序发送消息?

thanks谢谢

编写一个在您网站的服务器上运行的应用程序。

If you don't want any server side code then you either need to use any third party Javascript application.如果您不想要任何服务器端代码,那么您要么需要使用任何第三方 Javascript 应用程序。 (API) (API)

or you can try this also :或者你也可以试试这个:

<a href="mailto:emailaddress">Email</a>

1) For third party API you can try this also (Never tried it but looks good enough) 1) 对于第三方 API,您也可以尝试这个(从未尝试过,但看起来足够好)

www.mycontactform.com www.mycontactform.com

2) Mail Chimp (as Robert suggested) 2)邮件黑猩猩(如罗伯特建议的那样)

You will not be able to do this purely from javascript.您将无法仅通过 javascript 执行此操作。 You will need a server side component to connect to an SMTP server in order to be able to send your email.您将需要一个服务器端组件来连接到 SMTP 服务器,以便能够发送您的电子邮件。

Even if you were able to somehow develop an SMTP client for javascript, the security risks involved would much outweigh the advantages.即使您能够以某种方式为 javascript 开发 SMTP 客户端,所涉及的安全风险也将远远超过优势。 All your users will need to do to send email as you, is to go through your javascript code and get your SMTP credentials.您的用户需要做的就是像您一样发送电子邮件,就是通过您的 javascript 代码并获取您的 SMTP 凭据。

You can't do it by client side language.你不能通过客户端语言来做到这一点。 Use server side language like php to do that.使用像 php 这样的服务器端语言来做到这一点。

<?php
     mail(to,subject,message,headers,parameters);
?>

Copied from w3school复制自 w3school

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM