<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>birghtyoursite &#187; email script</title>
	<atom:link href="http://www.brightyoursite.com/blog/tag/email-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brightyoursite.com/blog</link>
	<description>Bright your site</description>
	<lastBuildDate>Mon, 19 Dec 2011 09:39:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>a easy way  add a contact page with captcha in magento</title>
		<link>http://www.brightyoursite.com/blog/2010/02/02/a-easy-way-add-a-contact-page-with-captcha-in-magento/</link>
		<comments>http://www.brightyoursite.com/blog/2010/02/02/a-easy-way-add-a-contact-page-with-captcha-in-magento/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 14:55:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[magento]]></category>
		<category><![CDATA[email script]]></category>

		<guid isPermaLink="false">http://www.brightyoursite.com/blog/?p=187</guid>
		<description><![CDATA[How easy it? if you are not familiar with magento and know php , this is the best and easy way for you to add a contact page with captcha in magento. What&#8217;s needed? As a contact page , we only need when client submit their information send a email and then if success show [...]]]></description>
			<content:encoded><![CDATA[<h3>How easy it?</h3>
<p>
if you are not familiar  with magento and know php , this is the best and easy way for you to add a contact page with captcha in magento.
</p>
<p><span id="more-187"></span></p>
<h3>What&#8217;s needed?</h3>
<p>
As a contact page , we only need when client submit their information send a email and then if success show a thanks page while not show errors , ask the client to try again . so we need a email script and captcha script . We will use a phpmailer to send email and <a href='http://recaptcha.net' rel='nofollow' target='_blank'>recaptcha.net</a> captcha .
</p>
<h3>How it work?</h3>
<p>
First,we need a email script with phpmailer and register  at  <a href='http://recaptcha.net' rel='nofollow' target='_blank'>recaptcha.net</a> to get a public and private key for your magento site .Let&#8217;s create a<br />
contact us page and a contact thanks page  in magento via magento cms , then put your email script form<br />
in contact us page ,for instance :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">enctype</span>=<span style="color: #ff0000;">&quot;multipart/form-data&quot;</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">&quot;http://yoursite.com/contact.php&quot;</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;form&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;row&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Name:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span>  <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;row&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>E-mail:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span>  <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Email&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;row&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fax:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span>   <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Fax&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;row&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Message:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">rows</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Message&quot;</span> <span style="color: #000066;">cols</span>=<span style="color: #ff0000;">&quot;45&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/textarea<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;br</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;br</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://api.recaptcha.net/challenge?k=6Ld_5woAAAAAAK-s6mYybMpCNpL-zwnGeY10idhn&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;br</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;reset&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Clear&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> <span style="color: #ddbb00;">&amp;nbsp;</span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;clear&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><b> Please take a notice for following codes : </b></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://api.recaptcha.net/challenge?k=6Ld_5woAAAAAAK-s6mYybMpCNpL-zwnGeY10idhn&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>You should replace  &#8217;6Ld_5woAAAAAAK-s6mYybMpCNpL-zwnGeY10idhn&#8217;   with your <a href='http://recaptcha.net' rel='nofollow' target='_blank'>recaptcha.net</a> public key   , that&#8217;s use to create the captcha .
</p>
<p>
Then upload recaptchalib.php and your contact.php which used to process the contact form to your site root directory.the contact page should like :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;phpmailer/class.phpmailer.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;phpmailer/class.smtp.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;recaptchalib.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$privatekey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;6Ld_5woAAAAAAGNVXku4-wDQtvYFUOxeeoPE4Avn&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;recaptcha_response_field&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$resp</span> <span style="color: #339933;">=</span> recaptcha_check_answer <span style="color: #009900;">&#40;</span><span style="color: #000088;">$privatekey</span><span style="color: #339933;">,</span>
                                        <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                                        <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;recaptcha_challenge_field&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                                        <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;recaptcha_response_field&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$resp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_valid</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                      <span style="color: #666666; font-style: italic;">/*... phpmailer send email script....*/</span>
                                     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Send</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                                      <span style="color: #009900;">&#123;</span>
                                          <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location:http://www.caterline.co.uk/contact-thanks&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
                                        <span style="color: #009900;">&#125;</span>
                                      <span style="color: #b1b100;">else</span>
                                      <span style="color: #009900;">&#123;</span>
	                                   <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;this is error when sending email ! &lt;a href='http://www.caterline.co.uk/contactusorm'&gt;try again&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
                                        <span style="color: #009900;">&#125;</span>
                                       <span style="color: #666666; font-style: italic;">/*... phpmailer send email script....*/</span>
                                <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You may notice the  codes:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$privatekey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;6Ld_5woAAAAAAGNVXku4-wDQtvYFUOxeeoPE4Avn&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>yes,you should  replace &#8217;6Ld_5woAAAAAAGNVXku4-wDQtvYFUOxeeoPE4Avn&#8217; with   your private key . Up to now , all finished . enjoy it !
</p>
<h3>Online demo</h3>
<p>
magento contact page with captcha and attachment (phpmailer send mail with attachment):<br />
<a href='http://dev.caterequipment.com/contact-us' target='_blank'>http://dev.caterequipment.com/contact-us</a>
</p>
<h3>Download source codes</h3>
<p>
<a href='http://www.brightyoursite.com/demo/magento/magento-captcha-contact-form.zip'>magento-captcha-contact-form.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightyoursite.com/blog/2010/02/02/a-easy-way-add-a-contact-page-with-captcha-in-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

