Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi all,

I'm working on Databound form for the one my project. So when I submit the form the entry of it comes into the admin panel but I did not receive the mail for the same. following is my code which I have used for the form: (Do I have to submit authentication details? If yes where should I put those details)
Code: Select all
<cms:form 
            masterpage=k_template_name
            mode='create'
            enctype='multipart/form-data'
            method='post'
            anchor='0'
            >
           
            <cms:if k_success >
           
                <cms:check_spam email=frm_email />
               
                <cms:db_persist_form
                    _invalidate_cache='0'
                    _auto_title='1'
                />
               
                <cms:if k_success >
                    <cms:set_flash name='submit_success' value='1' />
                    <cms:redirect k_page_link />
                </cms:if>
               
               
               
                <!-- EMAIL SUBMITTED DATA HERE -->
   <cms:send_mail from='test@gmail.com' to='frm_email' subject='Simple Databound Form' debug='1'>
Thank you for your enquiry, <cms:show first_name />.

Here is the mail summary:

Email ID: <cms:show frm_email /></br>
Portfolio Website: <cms:show frm_portfolio /></br>
Applying For: <cms:show frm_position /></br>
Salary Requirements: <cms:show frm_salary /></br>
Resume: <cms:show_securefile 'frm_resume' >
    <cms:if file_is_image >
        <a href="<cms:cloak_url link=file_id />"><img src="<cms:cloak_url link=file_id thumbnail='1' />" /></a><br />
        <cms:show file_name /> (<cms:size_format file_size />)
    <cms:else />
        <a href="<cms:cloak_url link=file_id />"><cms:show frm_resume /></a> (<cms:size_format file_size />)
    </cms:if>
</cms:show_securefile> 

</cms:send_mail>
   <!-- -->
               
               
               
            </cms:if>

           
            <cms:if k_error >
                <div class="alert alert-danger"><strong>Error:</strong>
                    <cms:each k_error >
                        <br><cms:show item />
                    </cms:each>
                </div>
            </cms:if>
           
         <div class="form-group <cms:if k_error_first_name || k_error_last_name >has-error</cms:if>">
            <label class="control-label" for="first-name">Name <span class="required">*</span></label>
            <div class="row">
               <div class="col-xs-6">
                  <cms:input class="form-control" id="first-name" name="first_name" placeholder="First" type="bound" value="" />
               </div>
               <div class="col-xs-6">
                  <cms:input class="form-control" id="last-name" name="last_name" placeholder="Last" type="bound" value="" />
               </div>
            </div>
         </div>
         <div class="form-group <cms:if k_error_email >has-error</cms:if>">
            <label class="control-label" for="email">Email Address <span class="required">*</span></label>
            <cms:input class="form-control" id="email" name="email" type="bound" value="" />
         </div>
         <div class="form-group <cms:if k_error_portfolio >has-error</cms:if>">
            <label class="control-label" for="portfolio">Portfolio Website</label>
            <cms:input class="form-control" id="portfolio" name="portfolio" type="bound" placeholder="http://" />
         </div>
         <div class="form-group <cms:if k_error_position >has-error</cms:if>">
            <label class="control-label" for="position">Which position are you applying for? <span class="required">*</span></label>
            <cms:input type='bound' class="form-control" id="position" name="position"  />   
         </div>
         <div class="form-group <cms:if k_error_salary >has-error</cms:if>">
            <label class="control-label" for="salary">Salary Requirements</label>
            <div class="row">
               <div class="col-sm-6">
                  <div class="input-group">
                     <span class="input-group-addon">$</span>
                     <cms:input class="form-control" id="salary" name="salary" type="bound" value="" />
                  </div>
               </div>
            </div>
         </div>
         <div class="form-group <cms:if k_error_resume >has-error</cms:if>">
            <label class="control-label" for="resume">Attach a Copy of Your Resume <span class="required">*</span></label>
            <cms:input id="resume" name="resume" type="bound" />
            <p class="help-block">Word or PDF Documents Only</p>
         </div>
            <div class="form-group <cms:if k_error_human >has-error</cms:if>">
            <label class="control-label" for="human">What colour is a blue apple? (4 characters required)</label>
            <cms:input class="form-control" id="human" name="human" type="text" required='1' validator='regex=/^blue$/i' />
         </div>
           
            <cms:if "<cms:not submit_success />" >
                <button class="btn btn-primary" type="submit">Submit Application</button>
            </cms:if>
           
      </cms:form>


I think this is the first time I have tried using databound forms, is this maybe the problem?
Or am I missing something stupid? (this is often the case, just need someone else to look at it and tell me what is wrong!)
Hi,
In your code, right after <cms:db_persist_form>, you are checking if that operation was successful and redirecting if it was.
Code: Select all
                <cms:if k_success >
                    <cms:set_flash name='submit_success' value='1' />
                    <cms:redirect k_page_link />
                </cms:if>

Once the *redirect* part is reached, the browser is simply made to move on to the redirected page and no code after that point is executed.

As, I think, you can see, your are emailing after that redirect and hence it never happens.

As the solution, place your emailing code before redirecting e.g. as follows -
Code: Select all
                <cms:if k_success >

                    EMAIL AT THIS POINT

                    <cms:set_flash name='submit_success' value='1' />
                    <cms:redirect k_page_link />
                </cms:if>

Hope this helps.
Thanks for your revert KK,

As per your suggestion I have changed the position of "send_mail" code but still I haven't receive the mail. My log file also shows "Delivery Success"

<cms:form
masterpage=k_template_name
mode='create'
enctype='multipart/form-data'
method='post'
anchor='0'
>

<cms:if k_success >

<cms:check_spam email=frm_email />

<cms:db_persist_form
_invalidate_cache='0'
_auto_title='1'
/>

<cms:if k_success >


<!-- EMAIL SUBMITTED DATA HERE -->
<cms:send_mail from='rupeshmore20@gmail.com' to=frm_email subject='Simple Databound Form' debug='1'>
Thank you for your enquiry, <cms:show first_name />.

Here is the mail summary:

Email ID: <cms:show frm_email /></br>
Portfolio Website: <cms:show frm_portfolio /></br>
Applying For: <cms:show frm_position /></br>
Salary Requirements: <cms:show frm_salary /></br>
Resume: <cms:show_securefile 'frm_resume' >
<cms:if file_is_image >
<a href="<cms:cloak_url link=file_id />"><img src="<cms:cloak_url link=file_id thumbnail='1' />" /></a><br />
<cms:show file_name /> (<cms:size_format file_size />)
<cms:else />
<a href="<cms:cloak_url link=file_id />"><cms:show frm_resume /></a> (<cms:size_format file_size />)
</cms:if>
</cms:show_securefile>

</cms:send_mail>
<!-- -->


<cms:set_flash name='submit_success' value='1' />
<cms:redirect k_page_link />
</cms:if>
</cms:if>


<cms:if k_error >
<div class="alert alert-danger"><strong>Error:</strong>
<cms:each k_error >
<br><cms:show item />
</cms:each>
</div>
</cms:if>

<div class="form-group <cms:if k_error_first_name || k_error_last_name >has-error</cms:if>">
<label class="control-label" for="first-name">Name <span class="required">*</span></label>
<div class="row">
<div class="col-xs-6">
<cms:input class="form-control" id="first-name" name="first_name" placeholder="First" type="bound" value="" />
</div>
<div class="col-xs-6">
<cms:input class="form-control" id="last-name" name="last_name" placeholder="Last" type="bound" value="" />
</div>
</div>
</div>
<div class="form-group <cms:if k_error_email >has-error</cms:if>">
<label class="control-label" for="email">Email Address <span class="required">*</span></label>
<cms:input class="form-control" id="email" name="email" type="bound" value="" />
</div>
<div class="form-group <cms:if k_error_portfolio >has-error</cms:if>">
<label class="control-label" for="portfolio">Portfolio Website</label>
<cms:input class="form-control" id="portfolio" name="portfolio" type="bound" placeholder="http://" />
</div>
<div class="form-group <cms:if k_error_position >has-error</cms:if>">
<label class="control-label" for="position">Which position are you applying for? <span class="required">*</span></label>
<cms:input type='bound' class="form-control" id="position" name="position" />
</div>
<div class="form-group <cms:if k_error_salary >has-error</cms:if>">
<label class="control-label" for="salary">Salary Requirements</label>
<div class="row">
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon">$</span>
<cms:input class="form-control" id="salary" name="salary" type="bound" value="" />
</div>
</div>
</div>
</div>
<div class="form-group <cms:if k_error_resume >has-error</cms:if>">
<label class="control-label" for="resume">Attach a Copy of Your Resume <span class="required">*</span></label>
<cms:input id="resume" name="resume" type="bound" />
<p class="help-block">Word or PDF Documents Only</p>
</div>
<div class="form-group <cms:if k_error_human >has-error</cms:if>">
<label class="control-label" for="human">What colour is a blue apple? (4 characters required)</label>
<cms:input class="form-control" id="human" name="human" type="text" required='1' validator='regex=/^blue$/i' />
</div>

<cms:if "<cms:not submit_success />" >
<button class="btn btn-primary" type="submit">Submit Application</button>
</cms:if>

</cms:form>
Is the site online or is it yet on locahost?
I ask this because localhost is generally unable to deliver emails; you'll have to online properly to test that.

In case your site is in fact online, then switch over to phpMailer as shown in the following thread and use the debugging technique as explained therein -
viewtopic.php?f=5&t=10750

Hope this helps.
@Rupesh1986,

Following up on what KK Sir has mentioned.

If you happen to have your site on an online server (not localhost) then you could try sending the mail again, but make sure that you remove the parameter debug='1' from the <cms:send_mail> tag before sending the mail.

Your Code:
Code: Select all
<cms:send_mail from='rupeshmore20@gmail.com' to=frm_email subject='Simple Databound Form' debug='1'>


Suggested Code:
Code: Select all
<cms:send_mail from='rupeshmore20@gmail.com' to=frm_email subject='Simple Databound Form' >


Also, make sure to check the spam folder of the recipient email. GMail always send such emails (as the one you are trying to send) to the spam box. But to make sure if your email is processed or not and see its status on your server you could search email (I suppose you are using cPanel) and navigate to Track Delivery. Please see the images attached.

Image #1: Where to Search:
image1-email-tracking.png
image1-email-tracking.png (24.84 KiB) Viewed 186 times


Image #2: What to use, to check email status:
image2-email-tracking.png
image2-email-tracking.png (37.86 KiB) Viewed 186 times


Regards,
GenXCoders
Image
where innovation meets technology
5 posts Page 1 of 1
cron