I followed the contact form tutorial and email sending is working. But there's a small problem.The problem is there are 2 message bodies in the email. I'll post a screenshot of the output i get.

Image

This is the code

Code: Select all
<cms:form action='' method='post' id='contact-form'>
                     <div class="field-row">
                        <cms:input type='text' name='name' id='name' required='1' placeholder='Name'/>
                        <cms:if k_error_name>
                           <p id='name_error' class='error animated shake' style="display:block"><i class="fa fa-exclamation" aria-hidden="true"></i>&nbsp;Insert a name</p>
                        </cms:if>
                     </div>
                     <div class="field-row">
                        <cms:input type='text' name='phone' id='phone' placeholder='Phone' maxlength='10'/>
                     </div>
                     <div class="field-row">
                        <cms:input type='text' name='email' id='email' required='1' validator='email' placeholder='Email'/>
                        <cms:if k_error_email>
                           <p id='email_error' class='error animated shake' style="display:block"><i class="fa fa-exclamation" aria-hidden="true"></i>&nbsp;Insert an e-mail</p>
                        </cms:if>
                     </div>
                     <div class="field-row">
                        <cms:input type='textarea' name='message' id='message' required='1' placeholder='Message'></cms:input>
                        <cms:if k_error_message>
                           <p id='message_error' class='error animated shake' style="display:block"><i class="fa fa-exclamation" aria-hidden="true"></i>&nbsp;Type your message</p>
                        </cms:if>
                     </div>
                     <div class="field-row">
                        <input type="submit" value="Submit" id="send_button">
                     </div>
                     <cms:if k_success>
                        <p id='mail_success' class='success text-success animated shake' style="display:block;"><i class="fa fa-thumbs-up" aria-hidden="true"></i>&nbsp;Thank You ! We will get back to you soon.</p>
                        <cms:send_mail html='1' from=k_email_from to=k_email_to reply_to=frm_email subject='Inquiry' debug='1'>
                           <p>The following email was sent by a visitor</p>
                           <table class="body" data-made-with-foundation>
                                 <tr>
                                    <td class="float-right" align="right" valign="top">
                                          <strong>Name&nbsp; : </strong>
                                    </td>
                                    <td class="float-left" align="left" valign="top">
                                       <cms:show frm_name/>
                                    </td>
                                 </tr>
                                 <tr>
                                    <td class="float-right" align="right" valign="top">
                                          <strong>Phone&nbsp; : </strong>
                                    </td>
                                    <td class="float-left" align="left" valign="top">
                                          <cms:show frm_phone/>
                                    </td>
                                 </tr>
                                 <tr>
                                    <td class="float-right" align="right" valign="top">
                                          <strong>Email&nbsp; : </strong>
                                    </td>
                                    <td class="float-left" align="left" valign="top">
                                          <cms:show frm_email/>
                                    </td>
                                 </tr>
                                 <tr>
                                    <td class="float-right" align="right" valign="top">
                                          <strong>Message&nbsp; : </strong>
                                    </td>
                                    <td class="float-left" align="left" valign="top">
                                          <cms:show frm_message/>
                                    </td>
                                 </tr>
                           </table>
                           <cms:show k_success/>
                        </cms:send_mail>
                     </cms:if>
                     <cms:if k_error>
                        <p id='mail_fail' class='error animated shake'><i class="fa fa-exclamation" aria-hidden="true"></i>&nbsp;Sorry, an error occured please try again later.</p>
                     </cms:if>
                  </cms:form>



Code is working and only problem I get that two message bodies are in the email and also if mail is failed to send error message is not displaying instead success message is displaying. I've been trying to figure this for hours but I couldn't. Any help would be appreciated.