创建发送电子邮件按钮

时间:2019-07-15 13:52:19

标签: php html forms kohana

我在kohana框架中制作了一些旧代码。需要创建单击“发送”按钮后激活的“发送测试电子邮件”功能。不知道该怎么做。测试电子邮件应包含来自电子邮件主题,内容字段的数据,并发送到输入的电子邮件地址。

<div class="block">
    <h3 class="orange">Email setup:</h3>
    <div class="form_row">

        <div>
            <label class="short">Email subject:</label>
            <?php echo Form::input('email_subject', $data['email_subject'], array('maxlength' => '100')) ?>
            <?php echo Html::image('img/help.gif', array('class' => 'help', 'width' => 13, 'height' => 13, 'title' => 'Some title, doesn't matter')) ?>
        </div>

        <div>
            <label class="textarea-label">Email content:</label>
            <?php echo Html::image('img/help.gif', array('class' => 'help', 'width' => 13, 'height' => 13, 'title' => 'Some title, doesn't matter')) ?>
            <?php echo Form::textarea('email_body', $data['email_body'], array('id' => 'textarea1')) ?>
        </div>

        <div>
            <label class="short">test email address field:</label>
            <?php echo Form::input('test_email', '' ,array('maxlength' => '50')) ?>
            <?php echo Html::image('img/help.gif', array('class' => 'help', 'width' => 13, 'height' => 13, 'title' => 'BCC address')) ?>
        </div>

        <div>
            <?php if(Auth::instance()->get_user()->username != 'some_user') echo Form::submit('save', 'Save') ?>
            <?php if(Auth::instance()->get_user()->username != 'some_user') echo Form::submit('send', 'Send test email') ?>
        </div>

    </div>
</div>

1 个答案:

答案 0 :(得分:0)

您可以使用表格

<form action="test.php" method="post">
<button name="btn_send">Send Email</button>
</form>

<?php
if (isset($_POST["btn_send"])) {
    //Sending email code
}
?>
相关问题