简体   繁体   中英

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.

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).

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?

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. You just need to put the full URL of the handler as the action in your form:

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

You can do the same thing with javascript XHR/ajax requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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