Designing forms has always been fun, but getting them to send email on the server side is another story. I have used various email scripts (dynaform,phpmailer, etc), and have experienced a ton of problems.
So here is the site I am working on: Contact On the Right. It is very basic: no validation, no required fields. I simply need anything that is entered to be sent back to me.
Does anyone k开发者_开发知识库now of any BASIC PHP form processing scripts, or have a few lines of code that would work here? I'm not a PHP guy, so I am struggling!
Thanks in advance.
I simply need anything that is entered to be sent back to me.
<?php
mail('your@mail.here','Site feedback',implode("\n\n",$_POST));
header("Location: thankyou.html");
?>
you can add this tag into thankyou.html:
<META HTTP-EQUIV="REFRESH" CONTENT="5;URL=http://v2.ztmag.com/livedates.html">
it will get user back in 5 seconds
For simple and hard tasks (it does HTML mail) this library always served me well: PHPMailer
Depending on servers and administrators, sometimes mail()
doesn't work.
It must be configured to work correctly with smtp or have a sendmail binary installed in the correct path.
PHPMailer, instead, only needs outbound connection trough fsockopen not to be disabled.
A simple tutorial here:
http://www.ustrem.org/en/articles/send-mail-using-phpmailer-en/
A number of CMS uses it internally, too. Joomla, for example.
精彩评论