Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

form submit button

I am using a basic html form on a webpage.  The form is data is sent to a CRM as a lead.  I don't want to pay the extra fee to have email alerts when a lead arrives, instead I'd like to add a script that will send an email to me when someone presses the submit button.  By the way it's in a WP page.

Any idea how I can do this?  Form is attached.
<form action="https://crm.zoho.com/crm/WebToLeadForm" method="post">
									
									<input name="xnQsjsdp" type="hidden" value="Lq0jaqtw4N4$" />
									
									<input name="xmIwtLD" type="hidden" value="Bi-mWp6ASSkfxf1fznbnRW-*B6-MHnNR" />
									
									<input name="actionType" type="hidden" value="TGVhZHM=" />
									
									<input name="returnURL" type="hidden" value="http://www.helloworld.com/thank-you/" />
									
									<div class="inputRow">
										
										<label for="firstNameTop">First Name:</label>

										<input maxlength="40" name="First Name" type="text" id="firstNameTop" />
										
									</div><!-- inputRow -->
									
									<div class="inputRow">
										
										<label for="lastNameTop">Last Name:</label>

										<input maxlength="80" name="Last Name" type="text" id="lastNameTop" />
										
									</div><!-- inputRow -->
									
									<div class="inputRow">
										
										<label for="emailTop">Email:</label>

										<input maxlength="100" name="Email" type="text" id="emailTop" />
										
									</div><!-- inputRow -->
									
									<div class="inputRow">
										
										<label for="phoneTop">Phone:</label>

										<input maxlength="30" name="Phone" type="text" id="phoneTop"/>
										
									</div><!-- inputRow -->
									
									<input name="save" type="submit" value="" class="contentTopBannerSubmitButton" />
																		
								</form><!--#form -->

Open in new window

0
HelpNearMe
Asked:
HelpNearMe
1 Solution
 
gavsmithCommented:
You can not send email using javascript, I saw your other post... there is a WP plugin called wp_mail_smtp (http://wordpress.org/extend/plugins/wp-mail-smtp/) which as the name suggests allows you to send email through a SMTP server of your choice. however if you don't have your own SMTP server you could end up having to pay for that so probably wouldn't save you anything.
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
In theory, you could invoke an ajax or javascript on-demand call to a server-side script with a query string that would send you an email. To do this in ajax, the script would have to reside in the same domain as the form page. But javascript on-demand is not so limited.
0
 
liranp1Commented:
try this link,

http://www.asp.net/general/videos/how-do-i-create-a-contact-us-page

i added this settings:

 <mailSettings>

      <smtp from="your mail address">

        <network

             host="smtp of ISP"
 
             userName="user"
 
             port="25"

             password="password"  />

      </smtp>

    </mailSettings >
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
keyuCommented:
use your gmail account authentication while sending your email if you dont have SMTP account.

for Wordpress using WP plugin :

http://sudarmuthu.com/blog/how-to-send-email-in-wordpress-using-gmails-smtp-server

For simple web form for your individual application :

http://yasserzaid.wordpress.com/2009/04/12/send-email-using-gmail-account/

Hope this helps



0
 
HelpNearMeAuthor Commented:
xmediaman:

Thanks for the info, I'm no javascript expert but could on use the onsubmit event to open a new .php page that would do the notifcation email then I could forward to the thank you page.  If this concept is correct can you give me an idea of how the onsubmit syntax would look?  I can deal with the php bit on my own, it's just the javascript part that I need help with.

Thanks,

HNM
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Do you need to include any of the data from the form in the email? Now that you've mentioned the thank you page, I have a better idea (I think). If you don't need any of the answers from the form, just an email alert that the form has been submitted, you could include a script in the head of your thank you page that sends you an email. Is there any way to get to the thank you page besides submitting the form? Unfortunately, I'm not familiar with Wordpress so I don't know how much control you have over the thank you page. Can your thank you page be a php file?

If your thank you page can be a php file and you don't need to include any of the responses in the email, you can add some php at the beginning of your thank you page to send the email.

If your thank you page cannot be a php file. Can you include script tags in the thank you page? You could include a script tag like:
< script type="text/ecmascript" src="http://pathtoyourphpfile.php"></script>

Open in new window


and your php file could be as simple as:
if ( (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'bot') == false) && 
		(strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'slurp') == false ) ) {
	$message = "A contact/lead has just submitted the form.\n\n";
	$recipients = 'your@email.address';
	mail($recipients,'Lead Alert!',$message,'FROM: your@email.address');
}
header('Content-type: text/ecmascript');
return '';

Open in new window


The if at the beginning of the php script is my lame attempt to stave off alerts triggered by spiders.
0
 
HelpNearMeAuthor Commented:
xmediaman:

The header script didn't seem to work so well, instead I added a test to the page body and it worked fine!  

<?php if(is_page('thank-you')) {

      if ( (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'bot') == false) && 
                  (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'slurp') == false ) ) {
            $message = "A contact/lead has just submitted the form.\n\n";
            $recipients = 'me@helloworld.com';
            mail($recipients,'Lead Alert!',$message,'FROM: info@helloworld.com);
      }

}  ?>


Thanks!

HNM
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Glad you could make it work. You're welcome.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now