doushuzd3033 2013-08-06 04:53
浏览 48

按下提交按钮时通过电子邮件发送

<?php
 echo $this->Form->end(__('Submit')) 
 $to = "someone@hotmail.com"; $subject = "Test mail";
 $message = "Hello! This is a simple email message.";
 $from = "someonelse@example.com";
 $headers = "From:" . $from;
 mail($to,$subject,$message,$headers);
 echo "Mail Sent.";
?>

Hey guys need help here! I want when someone pressed the submit button, it saves and sends the details entered to the emails

  • 写回答

3条回答 默认 最新

  • dongyata3336 2013-08-06 04:57
    关注

    You have to use like this.Make sure your button type is submit

    <?php
    if($_POST){
    
        $to = "someone@hotmail.com"; $subject = "Test mail";
        $message = "Hello! This is a simple email message.";
        $from = "someonelse@example.com";
        $headers = "From:" . $from;
        mail($to,$subject,$message,$headers);
        echo "Mail Sent.";
    
    
        }
        ?>
    
    评论

报告相同问题?