全球主机交流论坛

标题: 求个在线联系“联系我们”的表单 [打印本页]

作者: aming    时间: 2014-7-4 22:52
标题: 求个在线联系“联系我们”的表单
就是“联系我们”,可以让访客直接发送信息到你设置好的邮箱,不用留个邮箱,既怕被爬虫搜索到天天垃圾信,也不用麻烦访客登陆邮箱再发邮件给你

前台form表单我会抄,但后台处理发送的php就不会抄了。

这里牛人,求个


好多国外源码都有这个,WP也有大把插件,但真的不知道怎么抄成独立的php,以便在 <form method="post" action="xxx.php"> 引用
作者: 槛外人    时间: 2014-7-4 22:58
找个PHP发信的类,然后和表单数据连接起来。
作者: aming    时间: 2014-7-4 23:12
槛外人 发表于 2014-7-4 22:58
找个PHP发信的类,然后和表单数据连接起来。

之前找到个是SMTP发信的,SMTP不稳定不喜欢,然后尝试在其它源码抽,没成功。
按你搜索出来,感觉又太复杂了,只想要个简单的,能发送文本就可以了
作者: 槛外人    时间: 2014-7-4 23:14
aming 发表于 2014-7-4 23:12
之前找到个是SMTP发信的,SMTP不稳定不喜欢,然后尝试在其它源码抽,没成功。
按你搜索出来,感觉又太复 ...

那就直接用PHP的Mail函数吧。
作者: cnx    时间: 2014-7-4 23:45
http://www.codefuture.co.uk/projects/imagehost/demo/contact.php
这个应该很容易抠出来。
作者: aming    时间: 2014-7-5 00:13
cnx 发表于 2014-7-4 23:45
http://www.codefuture.co.uk/projects/imagehost/demo/contact.php
这个应该很容易抠出来。

前端当然简单,问题是后面处理的
<form method="post" action="contact.php">

作者: 冰剑    时间: 2014-7-5 00:17
叫我大叔我就告诉你
作者: orvice    时间: 2014-7-5 00:25
参考这


  1. <?php
  2.   $name = $_POST['firstname'] . ' ' . $_POST['lastname'];
  3.   $when_it_happened = $_POST['whenithappened'];
  4.   $how_long = $_POST['howlong'];
  5.   $how_many = $_POST['howmany'];
  6.   $alien_description = $_POST['aliendescription'];
  7.   $what_they_did = $_POST['whattheydid'];
  8.   $fang_spotted = $_POST['fangspotted'];
  9.   $email = $_POST['email'];
  10.   $other = $_POST['other'];

  11.   $to = 'owen@aliensabductedme.com';
  12.   $subject = 'Aliens Abducted Me - Abduction Report';
  13.   $msg = "$name was abducted $when_it_happened and was gone for $how_long.\n" .
  14.     "Number of aliens: $how_many\n" .
  15.     "Alien description: $alien_description\n" .
  16.     "What they did: $what_they_did\n" .
  17.     "Fang spotted: $fang_spotted\n" .
  18.     "Other comments: $other";
  19.   mail($to, $subject, $msg, 'From:' . $email);

  20.   echo 'Thanks for submitting the form.<br />';
  21.   echo 'You were abducted ' . $when_it_happened;
  22.   echo ' and were gone for ' . $how_long . '<br />';
  23.   echo 'Number of aliens: ' . $how_many . '<br />';
  24.   echo 'Describe them: ' . $alien_description . '<br />';
  25.   echo 'The aliens did this: ' . $what_they_did . '<br />';
  26.   echo 'Was Fang there? ' . $fang_spotted . '<br />';
  27.   echo 'Other comments: ' . $other . '<br />';
  28.   echo 'Your email address is ' . $email;
  29. ?>
复制代码

作者: aming    时间: 2014-7-5 00:29
冰剑 发表于 2014-7-5 00:17
叫我大叔我就告诉你

大叔你好
作者: aming    时间: 2014-7-5 00:32
orvice 发表于 2014-7-5 00:25
参考这

是不是保存成 contact.php ,表单引用就可以了?
作者: aming    时间: 2014-7-5 00:44
orvice 发表于 2014-7-5 00:25
参考这

不行啊,能发送,但是接收到邮件,只显示 echo 输出的内容,并不显示用户发送的内容……
  was abducted  and was gone for .
Number of aliens:
Alien description:
What they did:
Fang spotted:
Other comments:
作者: orvice    时间: 2014-7-5 01:23
aming 发表于 2014-7-5 00:32
是不是保存成 contact.php ,表单引用就可以了?

action引用
作者: 满意沟通    时间: 2014-7-5 03:03
qmail的 邮我
http://jingyan.baidu.com/article/d71306351cde2813fdf475c8.html
作者: 气味    时间: 2014-7-5 09:31

作者: cun    时间: 2014-7-5 11:17
sendmail搞定
作者: cnx    时间: 2014-7-5 12:03
aming 发表于 2014-7-5 00:13
前端当然简单,问题是后面处理的

我该说你笨呢还是笨呢。
这个就是程序官方主页,可直接下载的。




欢迎光临 全球主机交流论坛 (https://fd.vvwvv.eu.org/) Powered by Discuz! X3.4