简体   繁体   English

我可以使用远程托管的 phpmailer 文件从静态 html 页面发送电子邮件吗?

[英]Can I use a remotely hosted phpmailer file to send email from static html page?

Here is what I want to do:这是我想要做的:

I have a static shared web page on dropbox, since dropbox is not a server it cannot send mail via php.我在 dropbox 上有一个静态共享网页,因为 dropbox 不是服务器,它无法通过 php 发送邮件。

My page has an email form, and I wish to point it to a phpmailer file I host on my regular hosting account (instead of the usual setup, where the php file is on the same server).我的页面有一个电子邮件表单,我希望将它指向我在常规托管帐户上托管的 phpmailer 文件(而不是通常的设置,其中 php 文件位于同一服务器上)。

Will this work?这会起作用吗? Will the javascript be able to send the values to the php file if it does not reside on the same server?如果 php 文件不在同一台服务器上,它是否能够将值发送到 php 文件?

Off course I can test it, but I thought I might ask the community before I start.当然我可以测试它,但我想我可能会在开始之前询问社区。

Thanks in advance!提前致谢!

Yes.是的。 You will need to host a PHP script somewhere else, but you can point at it from anywhere.您将需要在其他地方托管 PHP 脚本,但您可以从任何地方指向它。 You just need to put the full URL of the handler as the action in your form:您只需要将处理程序的完整 URL 作为操作放入表单中:

<form method="post" action="http://www.example.com/formhandler.php">...

You can do the same thing with javascript XHR/ajax requests.你可以用 javascript XHR/ajax 请求做同样的事情。

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

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