php里面用户填完表格后,自动发email给用户邮箱的相关代码

解决方案 »

  1.   

    表单提交之后,你调用一下 mail函数,发送邮件就可以了。
    不过要保证你smtp服务器配置正确。
      

  2.   

    没有实际环境,我怎么给你写代码呢?
    其实很简单:
    比如:
    if ($_POST['submit']) //就是提交了表单
    {
       .... //这里做你的一些事情,比如写入数据库之类的。
       
      mail($to, $subject, $message, $headers);  //调用mail函数,具体用法请参看手册吧}
      

  3.   

    和我一样啊!我昨天才看php,原来一直是作asp.net2.0,搞了一天了,郁闷死了,php和apache配置让人太郁闷!
    在线等
      

  4.   

    用PHPMAILER发吧。他的官方网站上面有例子。
      

  5.   

    这个可以用。我使用过的
    <?php
    // multiple recipients
    $to  = '[email protected]' . ', '; // note the comma
    $to .= '[email protected]';// subject
    $subject = 'Birthday Reminders for August';// message
    $message = '
    <html>
    <head>
      <title>Birthday Reminders for August</title>
    </head>
    <body>
      <p>Here are the birthdays upcoming in August!</p>
      <table>
        <tr>
          <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
        </tr>
        <tr>
          <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
        </tr>
        <tr>
          <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
        </tr>
      </table>
    </body>
    </html>
    ';// To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// Additional headers
    $headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
    $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
    $headers .= 'Cc: [email protected]' . "\r\n";
    $headers .= 'Bcc: [email protected]' . "\r\n";// Mail it
    mail($to, $subject, $message, $headers);
    ?>
      

  6.   

    楼上的不行,不能够很好的移植,通用性不强!
    经过一夜和一上午的奋战!!终于搞定!
    详情请看我的http://blog.csdn.net/lg836
    我正在编写中