简体   繁体   English

有没有办法在不打开 Outlook 或 Apple Mail 的情况下使用 CSS(或任何与 web 开发相关的语言)中的“mailto”立即发送电子邮件?

[英]Is there a way to instantly send an e-mail using “mailto” in CSS (or any language-related to web development) without opening Outlook or Apple Mail?

I'm trying to create a personal website that has a contact form -- message box, for example -- but whenever I click submit or send, it opens up my Outlook e-mail, collects all the data I wrote down and then I have to click send again in Outlook to finally deliver that e-mail to someone.我正在尝试创建一个带有联系表格的个人网站——例如消息框——但是每当我点击提交或发送时,它都会打开我的 Outlook 电子邮件,收集我写下的所有数据,然后我必须再次单击 Outlook 中的发送才能最终将该电子邮件发送给某人。 I'm new to webDev, so I'm just wondering if it's possible.我是 webDev 的新手,所以我只是想知道这是否可能。

mailto: URLs are very unreliable and (when they work) always interact with the mail client on the user's machine. mailto: URL非常不可靠,并且(当它们工作时)总是与用户机器上的邮件客户端交互。

Any solution involving submitting a form to a web server and sending email using server-side programming won't.任何涉及将表单提交到 web 服务器并使用服务器端编程发送 email 的解决方案都不会。

Use a server-side solution.使用服务器端解决方案。 Third-party hosted options exist if you don't want to do any server-side programming yourself.如果您不想自己进行任何服务器端编程,则存在第三方托管选项。

The way to do this is to use a form to send data to your server.这样做的方法是使用表单将数据发送到您的服务器。 Your server then connects to an SMTP server to send the email.然后,您的服务器连接到 SMTP 服务器以发送 email。

If web pages could send emails on behalf of people without interaction, this would be used for spam.如果 web 页面可以在没有交互的情况下代表人们发送电子邮件,这将被用于垃圾邮件。

It is not possible to directly send email from the web browser, whether it is CSS, HTML, nor Javascript. It is not possible to directly send email from the web browser, whether it is CSS, HTML, nor Javascript.

I'm assuming that you'd like a contact page which would allow anyone visiting to fill in a small form which notifies you by email when they submit it?我假设您想要一个联系页面,允许任何访问者填写一个小表格,当他们提交时通过 email 通知您?

unfortunately, this isn't possible using only css, html or javascript - which are the tools available to you in the web browser.不幸的是,仅使用 css、html 或 javascript 是不可能的 - 这些是 Z2567ZA5EC9705E9789CD 浏览器中可用的工具。

If you're willing to go a little deeper, then this is entirely possible given a server-side application.如果您愿意 go 更深一点,那么这完全有可能给定一个服务器端应用程序。 It's common to do this kind of thing in PHP, but any server-side language would be able to do this.在 PHP 中做这种事情很常见,但任何服务器端语言都可以做到这一点。 You would need to do some set-up if you wanted to do it yourself, things like setting up a mail server to send outgoing mail.如果你想自己做,你需要做一些设置,比如设置一个邮件服务器来发送外发邮件。 These things can be tricky.这些事情可能很棘手。 I'm sure that there are also many hosted options available, but I'm afraid I don't know of any.我确信还有许多托管选项可用,但恐怕我不知道。

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

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