<?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>Php Development &#187; email</title>
	<atom:link href="http://www.maheshchari.com/tag/email/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maheshchari.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 17 Jan 2012 02:42:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>sending email with PHP (2)</title>
		<link>http://www.maheshchari.com/sending-email-with-php-2/</link>
		<comments>http://www.maheshchari.com/sending-email-with-php-2/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 14:15:01 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[email]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=715</guid>
		<description><![CDATA[Configure PHP email function for windows server. We learnt about sending mail from PHP with linux sendmail in this series of tutorial. On windows we don&#8217;t have pre configured email sever on mostly server. to fix this PHP mail function on windows, we can do with ini_set php function or setting it up on php.ini. [...]]]></description>
			<content:encoded><![CDATA[<h1>Configure PHP email function for windows server.</h1>
<p>We learnt about sending mail from PHP with linux sendmail in this series of <a href="http://www.maheshchari.com/sending-email-with-php-1/">tutorial</a>. On windows we don&#8217;t have pre configured email sever on mostly server. to fix this PHP mail function on windows, we can do with <strong>ini_set</strong> php function or setting it up on php.ini.</p>
<h2>Setting php.ini </h2>
<p>if you have access to php.ini ,you can change the default global value .</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">[mail function]
SMTP = localhost
sendmail_from = me@example.com</pre></div></div>

<h2>Setting at run time ini_set </h2>
<p>we can change this configuration at run time with <strong>ini_set</strong> function as given below. </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SMTP'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'localhost'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sendmail_from'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fromaddress@domain.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Example</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SMTP'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'localhost'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sendmail_from'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fromaddress@domain.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
&nbsp;
<span style="color: #000088;">$to</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'toaddress@domain.com'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Sample  subject'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'message body '</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$to</span><span style="color: #339933;">,</span> <span style="color: #000088;">$subject</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=715&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/sending-email-with-php-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sending email with PHP (1)</title>
		<link>http://www.maheshchari.com/sending-email-with-php-1/</link>
		<comments>http://www.maheshchari.com/sending-email-with-php-1/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 17:10:57 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[email]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=710</guid>
		<description><![CDATA[How to send email in PHP Email ( Electronic mail ) is most popular communication service on internet . Generally it is common practice to use this service as marketing media for digital products. There are a lot of free email service available on internet like Gmail, Yahoo,AOL and more. So as a developer we [...]]]></description>
			<content:encoded><![CDATA[<h1>How to send email in PHP</h1>
<p><strong>Email</strong> (<strong> Electronic mail </strong>) is most popular communication service on internet . Generally it is common practice to use this service as marketing media for digital products.   There are a lot of free email service available on internet like <strong>Gmail</strong>, <strong>Yahoo</strong>,<strong>AOL</strong> and more. </p>
<p>So as a developer we must know the <strong>mail</strong> functionality in PHP like <strong>send mail</strong> with php and <strong>read mail</strong> with PHP imap ,pop functions. in this tutorial we are going to learn how to send the mail with different MIM types and it mail components. </p>
<p>An email message consists of three components, the message <em>envelope</em>, the message <em>header</em>, and the message <em>body</em>. envelope controls the mail sending path like where it originated and where to be sent the mail. header part will denotes the contents of the email and sender and receiver information. body part contains the main user data information.In this series mail tutorial we learn with different PHP functions to send the mail.</p>
<p>On Linux server by default PHP comes with <strong>send mail</strong> or <strong>exim</strong> email server. But on windows PHP must be configured to allow from <strong>SMTP</strong> . </p>
<p>Main PHP <strong>extensions</strong> for email handling are </p>
<ul>
<li>Cyrus </li>
<li>IMAP </li>
<li>Mail</li>
<li>Mailparse</li>
<li>vpopmail</li>
</ul>
<h2>PHP email function</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">mail</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$to</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$subject</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$message</span> <span style="color: #339933;">,</span><span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>This function takes mainly four parameters, to,subject, message, headers.It will return a boolean that refers if mail is sent successfully or not. </p>
<h2>$to parameter</h2>
<p>$to parameter is a string to recipients of the email , we can give the &#8216;,&#8217; comma separated email address. it can be send for more than one recipients at at time.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$to</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&quot;To Display Name1&quot; &lt;reciever@domain1.dom&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$to</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">',&quot;To Display Name2&quot; &lt;reciever@domain2.dom&gt;'</span><span style="color: #339933;">;</span></pre></div></div>

<h2>$subject parameter</h2>
<pre>$subject="This is my sample subject.";</pre>
<p>$message parameter contain any length of string that is sperated with new line characters . </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$message</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Sample message line 1 <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;sample message line 2&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>&nbsp;</p>
<h2>$header  parameter</h2>
<p> is the modifier or extending the mail sending option.It has many options ,but we will discuss importent ones here. see below snippet for example.</p>
<pre>
$headers = 'From: "Sender Display Name" <sender@sender.dom>' . PHP_EOL .
'Cc: "CC Display Name" <info@domain.dom>' . PHP_EOL .
'X-Mailer: PHP-' . phpversion() . PHP_EOL.
'MIME-Version: 1.0' . PHP_EOL. 'Content-type: text/plain; charset=UTF-8' . PHP_EOL.
'X-Priority: 1 (Higuest)'.PHP_EOL.
'X-MSMail-Priority: High'.PHP_EOL.
'Importance: High'.PHP_EOL.
'Reply-To: info@example.com'.PHP_EOL.
'Return-Path: info@example.com.PHP_EOL.
'Message-Id: <' . md5(uniqid(microtime())) . '@' . $hostname . '>'.PHP_EOL.
           </pre>
<p>In the above code <strong>PHP_EOL</strong> is PHP constant that represent new line character . </p>
<h2>Main list of email headers</h2>
<p>&#038;nbsp</p>
<p><strong>From,</strong> email header notes from what email address is sent. </p>
<p><strong>Cc</strong> , this email header inform the server that this mail also can be sent to this email address also.</p>
<p><strong>X-Mailer,</strong> this email header inform the mail recipent client about the sender client. </p>
<p><strong>MIME ,</strong> this email header tells about the how the mail should be handle like plain text,html and attachment.</p>
<p><strong>X-Priority,</strong> tells the priority of the email for generel server.</p>
<p><strong>X-MSMail-Priority</strong>, tell the priority of the email for windows server hosted email servers.</p>
<p><strong>Importance</strong>, tells the priority of the email this will work for some of the email server.</p>
<p><strong>Reply-To</strong>, if user reply the sent email ,what the email address it to be taken, if it is not given default is From ,email header.</p>
<p><strong>Return-Path</strong>, if an email is bounced, where to be notified , this can be same email address like From or other email also.this email header can be used to track some email campains .</p>
<p><strong>Message-Id</strong>, is optional email header if we do not provide server will automatically generates and sends. this header can be used to track email campaings also.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=710&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/sending-email-with-php-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>protecting web contact forms from spam bots</title>
		<link>http://www.maheshchari.com/anti-spam-web-form/</link>
		<comments>http://www.maheshchari.com/anti-spam-web-form/#comments</comments>
		<pubDate>Sat, 16 May 2009 07:06:22 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[anti spam]]></category>
		<category><![CDATA[email]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=58</guid>
		<description><![CDATA[Protecting web forms from spam bots using PHP Spam bot is a program that submits the data to server by guessing form fields with html code. For detailed article please refer my previous post. Here some methods of preventing Spam bots that automatically submits. Using captcha Using random hidden field Using hidden input text box. [...]]]></description>
			<content:encoded><![CDATA[<h1>Protecting web forms  from spam bots using PHP</h1>
<p>Spam bot is a program that submits the data to server by guessing form fields with html code.<br />
For detailed article please refer my <a href="http://www.maheshchari.com/email-obfuscation/">previous post</a>.</p>
<h3>
Here some methods of preventing Spam bots that automatically submits.</h3>
<ul>
<li><a href="http://www.maheshchari.com/captcha-php-tutorial/">Using captcha</a></li>
<li>Using random hidden field</li>
<li>Using hidden input text box.  </li>
<li>Email header injecting.</li>
<li>Checking referrer page</li>
<li>Following basic rules</li>
</ul>
<p>We can prevent the Spam bots with some basic rules<br />
Prevent email harvesting on your web pages, see my previous post <a href="http://www.maheshchari.com/email-obfuscation/">anti email harvesting</a>.<br />
Generally Spam bots looks for form tag and contained input, check box, radio boxes, option element (Hhhh all the form elements), fills their data with their spam data so we can take this as advantage, some spam bots stores this information and sends with proxy without resubmitting the web contact form, so we can prevent this type of technics.<br />
Use deferent form fields than usually, like use ‘ xyz_nm’ instead ‘name’.Change the form field’s name in regular interval, like put ‘zmon_nm’ on ‘Monday’, ‘ztue_nm’ on ‘Tuesday’.<br />
Use random named hidden input field with a default value is empty on every form submission like captcha, if the default value of the hidden field changed other than default, it is sure Spam.<br />
Put one input text box element with random name and hide it with CSS style, since it won’t visible to general user, the default value could not changed, if any changes made to this value of input it is definitely Spam.<br />
Don’t put email address in the form elements, instead put it in sever side variable.<br />
Check for page referrer, however some server’s firewalls don’t allow this information, they strips the data.<br />
Use captcha like methods or services that are available present , but this captcha has some inconvenience to the user.<br />
Disabling or filtering HTML  message in form elements, since maximum spam bots try to fill HTML data.<br />
Make sure to access all the forms for login users and track down their messaging and ban certain user.<br />
<a href="http://www.maheshchari.com/wp-content/uploads/2009/05/protect-web-form-from-spams-maheshcharicom.jpg"><img src="http://www.maheshchari.com/wp-content/uploads/2009/05/protect-web-form-from-spams-maheshcharicom-300x246.jpg" alt="protect-web-form-from-spams-maheshcharicom" title="protect-web-form-from-spams-maheshcharicom" width="300" height="246" class="alignnone size-medium wp-image-66" /></a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #666666; font-style: italic;">#function that validate the user email
</span><span style="color: #000000; font-weight: bold;">function</span> is_valid_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$eregpat</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;^[A-z][A-z0-9_-]+([.]([A-z0-9_-])+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$eregpat</span><span style="color: #339933;">,</span><span style="color: #000088;">$email</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#function that validate user comments
</span><span style="color: #000000; font-weight: bold;">function</span> is_valid_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">#function that clean the user data againest 
</span><span style="color: #666666; font-style: italic;">#email header injection so we clean it
</span><span style="color: #000000; font-weight: bold;">function</span> safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">#clean non standerd alpha numeric and some special symbels
</span><span style="color: #666666; font-style: italic;">#clean email related headers like header,from,body,'cc','bcc',\r\n etc
</span><span style="color: #000088;">$patterns</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[^a-zA-Z0-9\.-@_]/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'from'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'header'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'body'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CC'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'BCC'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$patterns</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> send_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">#do what ever you want here with user data
</span><span style="color: #666666; font-style: italic;">#like storing into database or sending email to admin
</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#clean all data from user contact form and process this to store in mysql and sending email
</span>
<span style="color: #000000; font-weight: bold;">function</span> process_contactform<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$data</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sfsf_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'jflsjls_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'website'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'kipmp_website'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments_sfs'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
send_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'recaptchalib.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get a key from http://recaptcha.net/api/getkey</span>
<span style="color: #000088;">$publickey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;6LdVSQYAAAAAAFwb2919Sf8Uhcq3Z55bQc7d8Bx0&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$privatekey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;6LdVSQYAAAAAAIVT-VaJlea6WuOlLqJtt0UUK6xZ&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># the response from reCAPTCHA
</span><span style="color: #000088;">$resp</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">#error cacher
</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;"># was there a reCAPTCHA response?
</span><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</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;">&#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: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;You got it!&quot;</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: #666666; font-style: italic;"># set the error code so that we can display it
</span>                <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$resp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check the page that submits is belong to our domai or not
</span><span style="color: #666666; font-style: italic;">#remember some servers don't allow this data or don't have information
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">'This page can be prcessed from this domain only.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check email validation
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'jflsjls_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span>is_valid_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'jflsjls_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Invalid email address.'</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check comment validation 
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments_sfs'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span>is_valid_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments_sfs'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Trying to email header injection.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check user is bot or not
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'owjrj_ran'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'owjrj_ran'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'You are spam bot.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check user is bot or not
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mpmpm_rwrw'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mpmpm_rwrw'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'You are spam bot.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check all errors and process contact form
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
process_contactform<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#if errors display
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul class=&quot;errors&quot; &gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$v</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h2>HTML code</h2>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
&lt;title&gt;Contact Form&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&nbsp;
&lt;script type=&quot;text/javascript&quot;&gt;
&nbsp;
/*
This javascript form validation only for generel users.
the spam bots don't process this type javascript validation so we have to 
validate again on server side.
*/
function validate_form(){
&nbsp;
var errors='';
&nbsp;
var fm=document.contactform;
&nbsp;
if(fm.jflsjls_email.value==''){
errors+='Email required.\n';
}
&nbsp;
if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(fm.jflsjls_email.value))){
errors+='Invalid email address.\n';
}
&nbsp;
if(fm.comments_sfs==''){
errors+='Empty comments.\n';
}
&nbsp;
if(errors!=&quot;&quot;){
alert(errors);
return false;
}
return true;
}
&lt;/script&gt;
&lt;form action=&quot;&quot; method=&quot;post&quot; name=&quot;contactform&quot; id=&quot;contactform&quot; onsubmit=&quot;return validate_form();&quot;&gt;
  &lt;table width=&quot;500&quot; border=&quot;1&quot;&gt;
    &lt;tr&gt;
      &lt;th colspan=&quot;2&quot;&gt;Contact Me
        &lt;script&gt;
		//email obfuscation 
document.write(&quot;m&quot;+&quot;y&quot;+&quot;m&quot;+&quot;a&quot;+&quot;i&quot;+&quot;l&quot;+&quot; &amp;#64;&quot;+&quot;y&quot;+&quot;o&quot;+&quot;u&quot;+&quot;d&quot;+&quot;o&quot;+&quot;m&quot;+&quot;a&quot;+&quot;i&quot;+&quot;n&quot;+&quot; &amp;#46&quot;+&quot;c&quot;+&quot;o&quot;+&quot;m&quot;);
&lt;/script&gt;      &lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width=&quot;295&quot;&gt; Name &lt;/td&gt;
      &lt;td width=&quot;288&quot;&gt;&lt;input name=&quot;sfsf_name&quot; type=&quot;text&quot; id=&quot;sfsf_name&quot; /&gt;      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Email: * &lt;/td&gt;
      &lt;td&gt;&lt;input name=&quot;jflsjls_email&quot; type=&quot;text&quot; id=&quot;jflsjls_email&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; Web Site &lt;/td&gt;
      &lt;td&gt;&lt;input name=&quot;kipmp_website&quot; type=&quot;text&quot; id=&quot;kipmp_website&quot; value=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot;&gt;
	  &lt;!-- 
	  hidden field that real user can't see ,only spam bots can process
	  in some spam bots this hidden field don't change the value ,
	  they submit as it is
	   --&gt;
	  &lt;input name=&quot;owjrj_ran&quot; type=&quot;hidden&quot; id=&quot;owjrj_ran&quot; /&gt;
	  &lt;!--
	  to overcome we use text field that is hidden from real user.
	  but this field is precessed by spam bots.
	  it is simply .
	   --&gt;
        &lt;input name=&quot;mpmpm_rwrw&quot; type=&quot;text&quot; id=&quot;mpmpm_rwrw&quot; style=&quot;display:none&quot; value=&quot;&quot; /&gt;
        Comments*&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot;&gt;&lt;textarea name=&quot;comments_sfs&quot; cols=&quot;45&quot; rows=&quot;5&quot;&gt;&lt;/textarea&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;
	  &lt;!-- 
	  recaptcha text area field
	  this is another guarented check.
	  but it is not user freindly 
	   --&gt;
	  &lt;?php echo recaptcha_get_html($publickey, $errors);?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot; align=&quot;center&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot; /&gt;
        &lt;input type=&quot;reset&quot; name=&quot;Submit2&quot; value=&quot;Reset&quot; /&gt; 
        &lt;small&gt;* Required field &lt;/small&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<h3>Download Source Code</h3>
<p><a href='http://www.maheshchari.com/anti-spam-web-form/web-contact-form-with-anti-spam-methods/' rel='attachment wp-att-69'>web-contact-form-with-anti-spam-methods download link here</a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=58&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/anti-spam-web-form/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>email obfuscation</title>
		<link>http://www.maheshchari.com/email-obfuscation/</link>
		<comments>http://www.maheshchari.com/email-obfuscation/#comments</comments>
		<pubDate>Thu, 14 May 2009 11:47:37 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[anti spam]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=55</guid>
		<description><![CDATA[protecting E-mail Address on web pages with php, javascript from E-mail spammers E-mail Spam is flooding the Internet with many copies of the same message, in an attempt to force the message on people who would not otherwise choose to receive it.Most spam is Commercial advertising, often for dubious products, get-rich-quick schemes, or quasi-legal services. [...]]]></description>
			<content:encoded><![CDATA[<h1>protecting E-mail Address on web pages with php, javascript from E-mail spammers</h1>
<p>E-mail Spam is flooding the Internet with many copies of the same message, in an attempt to force the message on people who would not otherwise choose to receive it.Most spam is Commercial advertising, often for dubious products, get-rich-quick schemes, or quasi-legal services. Spam costs the sender very little to send &#8212; most of the costs are paid for by the recipient or the carriers rather than by the sender.</p>
<h3>How do they catch email address of users? Or how do they email harvesting?</h3>
<p>There are many ways to get users email address but here we talk about only two ways.</p>
<h3>From  web pages:</h3>
<p>Spammers have programs which spider through web pages, looking for email addresses, e.g. email addresses contained in mailto: HTML tags [those you can click on and get a mail window opened],a word contains @ symbol ,a word contains mailto:</p>
<h3>From various web contact or enquiry  forms.</h3>
<p>Some sites request various details via forms, e.g. guest books &amp; registrations forms.<br />
Spammers can get email addresses from those either because the form becomes available<br />
on the world wide web, or because the site sells / gives the emails list to others.<br />
some spammers use weak security web forms on certain websites to protect web form from spammers <a href="http://www.maheshchari.com/anti-spam-web-form/">please refer my post</a></p>
<h2>Preventing E-mail harvesting on web pages</h2>
<h3>e-mail Address munging or e-mail Obfuscation</h3>
<p>Address munging is the practice of disguising, or munging, to prevent it being automatically collected by spam bots.<br />
Some examples are</p>
<ul>
<li>no-one at example (dot) com</li>
<li>no-one@elpmaxe.com.invalid</li>
<li>moc.elpmaxe@eno-on</li>
<li>no-one@exampleREMOVEME.com.invalid</li>
<li>remove .invalid</li>
<li>no-one@exampleNOSPAM.com.invalid</li>
<li>n o &#8211; o n e @ e x a m p l e . c o m</li>
<li>no-one<em>@</em>example<em>.</em>com (as HTML)</li>
</ul>
<p>Even though the email harvesting reduced in measurable amount, with this method the main user has to predict the original. Now days some spam bots also overcomes this method.</p>
<h2>Using javascript </h2>
<p>Most of the spam bots don’t execute the javascript and they use regular expression to catch the address.<br />
So we can advance the method of munging with following examples</p>
<h3>For static web pages e-mail Obfuscation </h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'user'</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> at <span style="color: #339933;">=</span> <span style="color: #3366CC;">'@'</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> domain <span style="color: #339933;">=</span> <span style="color: #3366CC;">'example.com'</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span> <span style="color: #339933;">+</span> at <span style="color: #339933;">+</span> domain<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>‘m’<span style="color: #339933;">+</span>’y’<span style="color: #339933;">+</span>’m’<span style="color: #339933;">+</span>’a’<span style="color: #339933;">+</span>’i’<span style="color: #339933;">+</span>’l’<span style="color: #339933;">+</span>’ <span style="color: #339933;">&amp;</span>#<span style="color: #CC0000;">64</span><span style="color: #339933;">;</span>’<span style="color: #339933;">+</span>’y’<span style="color: #339933;">+</span>’o’<span style="color: #339933;">+</span>’u’<span style="color: #339933;">+</span>’d’<span style="color: #339933;">+</span>’o’<span style="color: #339933;">+</span>’m’<span style="color: #339933;">+</span>’a’<span style="color: #339933;">+</span>’i’<span style="color: #339933;">+</span>’n’<span style="color: #339933;">+</span>’ <span style="color: #339933;">&amp;</span>#<span style="color: #CC0000;">46</span>’<span style="color: #339933;">+</span>’c’<span style="color: #339933;">+</span>’o’<span style="color: #339933;">+</span>’m’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #006600; font-style: italic;">//In the above example we use html equivalent ASCII chars &amp;#64 for  symbol and &amp;#46 for ‘.’ Character.</span></pre></td></tr></table></div>

<h3>
For dynamic web pages with PHP server side language e-mail Obfuscation</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> safe_asciimail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$length</span><span style="color: #339933;">=</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$length</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$email_array</span><span style="color: #339933;">=</span><span style="color: #990000;">str_split</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$ascii_email_array</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$c</span><span style="color: #339933;">=</span><span style="color: #000088;">$email_array</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$ascii_email_array</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&amp;#'</span><span style="color: #339933;">.</span><span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">';'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;script&gt; document.write(&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$ascii_email_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);&lt;/script&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//We can call this method as follow </span>
<span style="color: #666666; font-style: italic;">//safe_asciimail(‘mymail@yourdomain.com’);</span></pre></td></tr></table></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=55&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/email-obfuscation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

