dongnianwo8289 2015-05-19 20:09
浏览 127

PHP的简单邮件表格[复制]

This question already has an answer here:

Im trying to learn how to send mail with PHP. I have the following that redirects (so my code is being read) but the mail isnt being sent, can anybody see any obvious syntax mistakes? I cant understand whats wrong?

    $aaa = $_POST['recipient-name'];
                    $bbb = $_POST['address-line'];
                    $ccc = $_POST['town-name'];
                    $ddd = $_POST['county-name'];
                    $eee = $_POST['postcode-name'];
                    $fff = $_POST['mesage-blob']; 


                    // The message
                    $message = $aaa . ' and ' . $bbb . ' and ' . $ccc . ' and ' . $ddd . ' and ' . $eee . ' and ' . $fff;

                    // In case any of our lines are larger than 70 characters, we should use wordwrap()
                    $message = wordwrap($message, 70, "
");

                    // Send

                    mail('hello@site.co.uk', 'subjeeect', $message);  
                    header('Location: /thankyou.php');
</div>
  • 写回答

1条回答 默认 最新

  • dongshi8359 2015-05-19 20:13
    关注

    The code seems to be ok, but I have only one question. Are you testing that code in a localhost? maybe xampp or wamp? If yes, this will never work as you cannot send an email with php's mail function unless you have a mail server in your localhost.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#网络安全#的问题:求ensp的网络安全,不要步骤要完成版文件
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥20 使用Photon PUN2解决游戏得分同步的问题
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM