dongqishun6409 2014-09-23 00:27
浏览 67

尝试使用带有jQuery验证小部件的sendmail.php的表单邮件

When I enter data in the web page form and click the send button I receive the "mailed successfully" message, but nothing is showing up in by email inbox. Can anyone tell me where my error is in the following code?

HTML:

<aside class="widget widget_custom_contact_form_entries">

    <h6 class="widgettitle">Quick Message</h6>

    <div class="cmsms-form-builder">

    <di

v class="widgetinfo">Thank you! <br /> Your message has been sent successfully. </div>


JQUERY:

    <script type="text/javascript">

        jQuery(document).ready(function () {    
                                                                                        jQuery('#form_contact_form_widget_001').validationEngine('init');

            jQuery('#form_contact_form_widget_001a#contact_form_widget_001_wformsend').click(function ()            {var form_builder_url = jQuery('#contact_form_widget_001_wurl').val();

            jQuery('#form_contact_form_widget_001 .loading').animate( {opacity : 1} , 250);

                if 

                    (jQuery('#form_contact_form_widget_001').validationEngine('validate')) {                            jQuery.post(form_builder_url, {field_002 : jQuery('#field_002').valfield_003 :                      jQuery('#field_003').val(), field_004 : jQuery('#field_004').val(),                             formname : 'contact_form_widget_001', formtype : 'widget'}, function () {                           jQuery('#form_contact_form_widget_001 .loading').animate( { opacity : 0 }, 250);

                    document.getElementById('form_contact_form_widget_001').reset();
                                                                                                jQuery('#form_contact_form_widget_001').parent().find('.widgetinfo').hide();                                                                                                    jQuery('#form_contact_form_widget_001').parent().find('.widgetinfo').fadeIn('fast');    
                    jQuery('html, body').animate( { scrollTop :                                                 (jQuery('#form_contact_form_widget_001').offset().top - 100) }, 'slow');    
                        jQuery('#form_contact_form_widget_001').parent().find('.widgetinfo').delay(5000)
                        .fadeOut(1000);

                    } );

                    return false; } 

                else {  
                                                                                                jQuery('#form_contact_form_widget_001 .loading').animate( { opacity : 0 }, 250);

                    return false;

                }

            } );

        } );

    </script>                                   

HTML:

    <form action="mailto:scottmriley@yahoo.com" method="post" id="form_contact_form_widget_001">

        <div class="form_info cmsms_input">

            <label for="field_002">Your Name<span class="color_3">*</span></label>

            <input type="text" name="wname" id="field_002" size="22" tabindex="11"                          class="validate[required,minSize[3],maxSize[100],custom[onlyLetterSp]]" />

        </div>

        <div class="form_info cmsms_input">

            <label for="field_003">Email<span class="color_3">*</span></label>

            <input type="text" name="wemail" id="field_003" size="22" tabindex="12"                             class="validate[required,custom[email]]" />

        </div>

        <div class="form_info cmsms_textarea">

            <label for="field_004">Message<span class="color_3"> *</span></label>

            <textarea name="wmessage" id="field_004" cols="28" rows="6" tabindex="13"                               class="validate[required,minSize[3]]"></textarea>

        </div>

        <div class="loading"></div>

        <div>

            <input type="hidden" name="contact_form_widget_001_wurl" id="contact_form_widget_001_wurl"              value="php/sendmail.php" />

        </div><!-- Here you need to set the path to the sendmail file -->

        <div>

            <a href="php/sendmail.php" id="contact_form_widget_001_wformsend" class="button"                        tabindex="14"><span>Send Message</span></a>

            <input type="reset" class="button" value="Reset" />

        </div>

    </form>

</aside>




PHP:

?php
if (isset($_REQUEST['formtype']) && $_REQUEST['formtype'] == 'form') {
    if (isset($_REQUEST['formname'])) { 
    }
} elseif (isset($_REQUEST['formtype']) && $_REQUEST['formtype'] == 'widget') {
    if (isset($_REQUEST['formname'])) {
        $formname = $_REQUEST['formname'];
        $field_002 = $_REQUEST['field_002'];
        $field_003 = $_REQUEST['field_003'];
        $field_004 = $_REQUEST['field_004'];

        $mailAddress = 'scottmriley@yahoo.com';
        $subject = 'Subject';
        $msg = "Message $field_002
 $field_003
 $field_004";
        $headers = "MIME-Version: 1.0
 Content-type: text/plain; charset=utf-8
 From: " . $_REQUEST[$result->slug] . "
 Reply-To: " . $_REQUEST[$result->slug] . "
 X-Mailer: PHP/" . phpversion();

        mail($mailAddress, $subject, $msg, $headers);
    }
} elseif (isset($_REQUEST['formtype']) && $_REQUEST['formtype'] == 'contactf') {
    if (isset($_REQUEST['formname'])) {
        $formname = $_REQUEST['formname'];
        $contact_name = $_REQUEST['contact_name'];
        $contact_email = $_REQUEST['contact_email'];
        $contact_url = $_REQUEST['contact_url'];
        $contact_subject = $_REQUEST['contact_subject'];
        $contact_message = $_REQUEST['contact_message'];

        $mailAddress = 'scottmriley@yahoo.com';
        $subject = 'Subject';
        $msg = "$contact_name
 $contact_email
 $contact_url
 $contact_subject
 $contact_message";
        $headers = "MIME-Version: 1.0
 Content-type: text/plain; charset=utf-8
 From: " . $_REQUEST[$result->slug] . "
 Reply-To: " . $_REQUEST[$result->slug] . "
 X-Mailer: PHP/" . phpversion();

        mail($mailAddress, $subject, $msg, $headers);
    }
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题