【问题标题】:My Formspree contact form isn't sending out the email information我的 Formspree 联系表未发送电子邮件信息
【发布时间】:2016-12-14 20:21:02
【问题描述】:

我一直在我的一个网站上使用 formspree。起初一切正常,然后表单消息没有发送电子邮件。发送表单时,我看到了姓名和消息,但电子邮件没有注册。我查看了简码,并没有看到任何内容。有人看到这里的问题吗?

在大多数浏览器中,我的“我正在寻找报价”字样与我的复选框重叠。我放了一个 p 并把它拿出来,但我认为这可能会弄乱代码。对此也有什么想法吗?

这是 HTML:

                <form role="form" id="formspree" method="post">

                    <div class="form-group">
                        <label class="sr-only" for="contact-name">Your Name</label>
                        <input type="text" name="name" placeholder="Your Name" class="contact-email form-control" id="contact-email">
                    </div>
                   <input type="text" name="_gotcha" style="display:none">
                    <div class="form-group">
                        <label class="sr-only" for="contact-email">Email</label>
                        <input type="text" name="email" placeholder="Email" class="contact-email form-control" id="contact-email">
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="contact-message">Message</label>
                        <textarea name="message" placeholder="Message" class="contact-message form-control" id="contact-message" style="height: 168px;width:100%;"></textarea>
                    </div>
                    <div class="row">
                        <div class="col-sm-6" style="
text-align: right;
padding-right: 15px;

                            <div class="form-group"><label class="checkbox-inline"><input id="looking_for_quote" type="checkbox" value="quote">I'm Looking For A Quote</label>
                           </div>
                        </div>
                        <div class="col-sm-6">

                            <button type="submit" class="btn btn-lg"> Send Message</button>
                        </div>
                    </div>
                </form>

这是脚本:

$(document).ready(function() {

    // process the form
    $('form[method=post]').submit(function(event) {
        var email = "mat.mcsales@verizon.net";
       if ($('#looking_for_quote').is(':checked')) {
              email = "orders.mcsales@gmail.com";
        }

        $.ajax({
            url: "https://formspree.io/" + email,
            method: "POST",
            data: {
                message: $('textarea').val(),
                from: $('input[name=name]').val(),
                _reply: $('input[type=email]').val()
            },
            dataType: "json",
            success: function() {
                alert("Thanks! We'll get back to you soon.");
            }
        });

        // stop the form from submitting the normal way and refreshing the page
        event.preventDefault();
    });

});

【问题讨论】:

  • 我想通了。我将 _reply: $('input[type=email]').val() 更改为 email: $('input[name=email]')。 val()

标签: javascript php html forms email


【解决方案1】:

我想通了。我将 _reply: $('input[type=email]').val() 更改为 email: $('input[name=email]').val()

【讨论】:

    猜你喜欢
    • 2019-10-03
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多