简体   繁体   English

使用 Javascript 发送电子邮件?

[英]Sending email with Javascript?

How can I have user on my site send an email to someone using their own email directly from the website without opening email application?如何让我网站上的用户直接从网站使用他们自己的电子邮件向某人发送电子邮件,而无需打开电子邮件应用程序?

I have an app where they create a PDF and at the end they need to email it to someone from their email by entering their email and clicking a button.我有一个应用程序,他们可以在其中创建 PDF,最后他们需要通过输入他们的电子邮件并单击按钮将其通过电子邮件发送给某人。 Is there any way to do that?有没有办法做到这一点?

Sorry if this is obvious, but I've done a lot of looking around and can't seem to find a relevant answer.对不起,如果这很明显,但我已经环顾四周,似乎无法找到相关的答案。 Thank you for your time!感谢您的时间!

You can use the same PHP as my answer here :您可以在此处使用与我的答案相同的 PHP:

$to = "person@example.com";
$subject = "Foo and Bar";
$body = "Lorem ipsum dolor";

mail ($to,$subject,$body);

The above is a very basic mail system.以上是一个非常基本的邮件系统。 It can be integrated with a form for more options, and accessibility from a HTML page.它可以与表单集成以获得更多选项,以及从 HTML 页面访问。

More information about mail() can be found here .可以在此处找到有关mail()更多信息。

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

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