<?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>Klovera &#187; Programming &amp; Scripting</title>
	<atom:link href="http://www.klovera.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klovera.com</link>
	<description></description>
	<lastBuildDate>Wed, 04 Jan 2012 19:43:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>PHP Subtract Dates</title>
		<link>http://www.klovera.com/php-subtract-dates/</link>
		<comments>http://www.klovera.com/php-subtract-dates/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 21:07:45 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.klovera.com/?p=1872</guid>
		<description><![CDATA[The following function will return the number of days between two dates. function dateDiff($beginDate, $endDate) { $fromDate = date('Y-n-j',strtotime($beginDate)); $toDate = date('Y-n-j',strtotime($endDate)); $date_parts1=explode('-', $beginDate); $date_parts2=explode('-', $endDate); $start_date=gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]); $end_date=gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]); return $end_date - $start_date; } // example $from = '2011-1-6'; $to = '2011-1-8'; dateDiff($from,$to); // returns 2]]></description>
			<content:encoded><![CDATA[<p>The following function will return the number of days between two dates.</p>
<pre class="brush: php">
function dateDiff($beginDate, $endDate) {
	$fromDate = date('Y-n-j',strtotime($beginDate));
	$toDate = date('Y-n-j',strtotime($endDate));
	$date_parts1=explode('-', $beginDate);
	$date_parts2=explode('-', $endDate);
	$start_date=gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]);
	$end_date=gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]);
	return $end_date - $start_date;
}
</pre>
<pre class="brush: php">
// example
$from = '2011-1-6';
$to = '2011-1-8';
dateDiff($from,$to); // returns 2
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/php-subtract-dates/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Turn off IPv6 CentOS and CSF</title>
		<link>http://www.klovera.com/turn-off-ipv6-centos-and-csf/</link>
		<comments>http://www.klovera.com/turn-off-ipv6-centos-and-csf/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 04:37:05 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[centOS]]></category>

		<guid isPermaLink="false">http://www.klovera.com/?p=1822</guid>
		<description><![CDATA[If you are running csf on your CentOS server and run the server security check you may have seen the following message: Check for IPv6: IPv6 appears to be enabled [ifconfig: ]. If ip6tables is installed, you should enable the csf IPv6 firewall (IPV6 in csf.conf). To disable IPv6 on RHEL/CentOS you should follow this [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running csf on your CentOS server and run the server security check you may have seen the following message:</p>
<blockquote><p><strong>Check for IPv6:</strong> IPv6 appears to be enabled [ifconfig: ]. If ip6tables is installed, you should enable the csf IPv6 firewall (IPV6 in csf.conf). To disable IPv6 on RHEL/CentOS you should follow <a href="http://kbase.redhat.com/faq/docs/DOC-8711">this link</a>.</p></blockquote>
<p>Upon following the link you end up at the login screen for access.redhat.com. Even after creating an account viewing the link requires a subscription. Seems a little odd that a subscription is required to find out how to disable IPv6&#8230;</p>
<p>So, here is how you do it:</p>
<ol>
<li>Log into the server as root</li>
<li>Type in the following:
<pre class="brush: shell">
# touch /etc/modprobe.d/disable-ipv6
# echo "options ipv6 disable=1" >> /etc/modprobe.d/disable-ipv6
</pre>
<p>Note: Slightly different prior to the 5.4 update. For more information on the above see <a href="http://wiki.centos.org/FAQ/CentOS5#head-47912ebdae3b5ac10ff76053ef057c366b421dc4">this link</a> on the centos wiki. Its a bit more helpful than the link provided in the csf notes.
</li>
<li>Restart the server</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/turn-off-ipv6-centos-and-csf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Tutorials</title>
		<link>http://www.klovera.com/jquery-tutorials/</link>
		<comments>http://www.klovera.com/jquery-tutorials/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 00:17:00 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=361</guid>
		<description><![CDATA[Been brushing up on my jQuery. Here are some GREAT tutorials that take things from scratch&#8230; jQuery for Absolute Beginners from ThemeForest.net]]></description>
			<content:encoded><![CDATA[<p>Been brushing up on my jQuery. Here are some GREAT tutorials that take things from scratch&#8230;</p>
<p><a href="http://blog.themeforest.net/screencasts/jquery-for-absolute-beginners-video-series/">jQuery for Absolute Beginners from ThemeForest.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/jquery-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USB Drive Autorun</title>
		<link>http://www.klovera.com/usb-drive-autorun/</link>
		<comments>http://www.klovera.com/usb-drive-autorun/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 11:58:55 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=321</guid>
		<description><![CDATA[I have been hunting for a good way to get a USB Flash Drive to autorun when inserted into a computer. The ideal solution would work just as a CD&#8217;s autorun (ie work with all versions of Windows and MacOS). Given my time constraint I was only able to locate a solution that works 100% [...]]]></description>
			<content:encoded><![CDATA[<p>I have been hunting for a good way to get a USB Flash Drive to autorun when inserted into a computer. The ideal solution would work just as a CD&#8217;s autorun (ie work with all versions of Windows and MacOS). Given my time constraint I was only able to locate a solution that works 100% with Windows Vista.</p>
<p><em>If anyone has a link to the Holy Grail of USB Flash Drive Autorun please comment below :)</em></p>
<p><strong>Here is what I used </strong><br />(used it to autorun a Flash Windows Projector file):</p>
<p>Create an Autorun.inf file and place it at the root of your flash drive along with your program files.</p>
<pre class="brush: php">
[AutoRun]
OPEN=YourProgram.exe
ICON=YourProgramFileWithIcon.exe
ACTION=Message that is displayed
LABEL=Drive Label
</pre>
<p> Here is <a href="http://www.samlogic.net/articles/autorun-usb-flash-drive.htm">the link</a> where most the info I used was found.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/usb-drive-autorun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changing back to default permissions</title>
		<link>http://www.klovera.com/changing-back-to-default-permissions/</link>
		<comments>http://www.klovera.com/changing-back-to-default-permissions/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 22:02:30 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=232</guid>
		<description><![CDATA[When modifying file permissions it is sometimes necessary to go back to the drawing board and set back to the default permissions. The following command can be used via ssh and takes a couple seconds vs trying to do this via ftp file by file (which can take a very long time depending on the [...]]]></description>
			<content:encoded><![CDATA[<p>When modifying file permissions it is sometimes necessary to go back to the drawing board and set back to the default permissions. The following command can be used via ssh and takes a couple seconds vs trying to do this via ftp file by file (which can take a very long time depending on the size of your website)</p>
<p>Change to the directory you want changed, then run these;</p>
<pre class="brush: shell">
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
</pre>
<p>Will set permission for all files to 644 and all directories to 755.</p>
<p>This works for pretty much any Linux server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/changing-back-to-default-permissions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Finally, how to set SpamAssasin!</title>
		<link>http://www.klovera.com/finally-how-to-set-spamassasin/</link>
		<comments>http://www.klovera.com/finally-how-to-set-spamassasin/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 02:31:42 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[PLESK]]></category>
		<category><![CDATA[SpamAssasin]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=181</guid>
		<description><![CDATA[I proudly battle against spam on behalf of my clients! Running PLESK and SpamAssassin, it takes a lot of tweaks to make sure the mystery meat doesn&#8217;t get through. I recently came across the following and am currently testing it out. So far, its looking good! Originally posted at www.jaguarpc.com by thisisit3 - START Contrary [...]]]></description>
			<content:encoded><![CDATA[<p>I proudly battle against spam on behalf of my clients! Running PLESK and SpamAssassin, it takes a lot of tweaks to make sure the mystery meat doesn&#8217;t get through. I recently came across the following and am currently testing it out. So far, its looking good!</p>
<p>Originally posted at <a href="http://www.jaguarpc.com/forums/showthread.php?t=17227">www.jaguarpc.com</a> by thisisit3</p>
<p><span id="more-470"></span><br />
- START</p>
<p>Contrary to popular belief, spam is easy to combat. All it takes is a well configured SpamAssassin running on the server. Unfortunately the definition of &#8220;well configured&#8221; is very loosely defined in this context as its completely different for every domain/server.</p>
<p>One such example is the average person who blocks emails that contain the word &#8220;viagra&#8221;, but an actual medical doctor may use that word rather regularly.</p>
<p>So here is how to make SpamAssassin block 99% of spam:</p>
<h4>STEP 1 &#8211; Raise score for Realtime Blackhole lists (RBL)</h4>
<p>The default scores for RBLs are set too low. For example, if an email is marked as spam by SORBS then there is no reason giving it a score of 2. Based on my tests over a two year period RBLs are very safe to use. There are some issues with SpamCop but those always resolve after a few days.</p>
<p>Edit your &#8220;/etc/mail/spamassassin/local.cf&#8221; and add:</p>
<pre class="brush: bash">
# Raise RBL scores
score RCVD_IN_BL_SPAMCOP_NET 10
score RCVD_IN_SBL 5
score RCVD_BY_IP 2
score DNS_FROM_AHBL_RHSBL 3
score URIBL_WS_SURBL 3
score RCVD_IN_SORBS_WEB 3
score RCVD_IN_SORBS_SMTP 3
score URIBL_OB_SURBL 5
score RCVD_IN_NJABL_DUL 4
score RCVD_IN_XBL 5
score RCVD_IN_SORBS_DUL 3
score URIBL_SBL 5
score URIBL_JP_SURBL 4
</pre>
<h4>STEP 2 &#8211; Raise score for BAYES</h4>
<p>The default scores for BAYES are set to the lowest possible. These scores are automaticaly generated by a special script used by the developers of SpamAssassin and its generates the score based on all the rules. Unfortunately the high probability scores are too low, for example a 90% probability is a definit spam, so there is no reason why its score should be 2.</p>
<p>Edit your &#8220;/etc/mail/spamassassin/local.cf&#8221; and add:</p>
<pre class="brush: bash">
# Raise bayes scores
score BAYES_80 3.5
score BAYES_95 4.5
score BAYES_99 5.0
</pre>
<h4>STEP 3 &#8211; S.A. Rules Emporium (SARE)</h4>
<p>There is a special team of commandos who track daily spam. These guys have sat down and written rules that target specific strings within spam. One such tick is to scan for telephones and addresses used in spam, thus they don&#8217;t need to look for &#8220;viagra&#8221; in all its different variations instead they look for the phone or address of the guy selling them. As a result, their rules allow a doctor to get emails with &#8220;viagra&#8221; in them, while blocking spam at the same time.</p>
<p>These guys go even further, they have rules for:<br />
- Rules to detect commonly abused redirectors and uri obfuscation techniques.<br />
- Addresses and phone numbers harvested from spam<br />
- Bayes poison using lists of words with equal length<br />
- HTML coding rules that detect various spammer tricks applied through HTML coding within messages<br />
- Header rules that are not found in other SARE rulesets.<br />
- Rule set which flags specific spam and/or spam from specific spammers<br />
- SARE Adult rules are designed to catch spam with &#8220;Adult&#8221; material.<br />
- SARE &#8220;BML&#8221; rules are designed to catch &#8220;business, marketing and educational&#8221; spam.<br />
- SARE Fraud rules are designed to catch &#8220;Nigerian 419&#8243;, &#8220;International Lotto&#8221;, etc. type scams.<br />
- LOADS OF OTHERS&#8230;</p>
<p>Their website is at: <a href="http://www.rulesemporium.co">http://www.rulesemporium.com/</a></p>
<p>Below are the safest rule sets which can be used everywhere. Just go to your &#8220;/etc/mail/spamassassin/&#8221; directory and run the following commands from the shell, thats all you need to do, they are automatically included when SA scans that directory.</p>
<pre class="brush: bash">
wget&nbsp;http://www.rulesemporium.com/rules/70_sare_evilnum0.cf
wget&nbsp;http://www.rulesemporium.com/rules/70_sare_evilnum1.cf
wget&nbsp;http://www.rulesemporium.com/rules/70_sare_header0.cf
wget&nbsp;http://www.rulesemporium.com/rules/70_sare_html0.cf
wget&nbsp;http://www.rulesemporium.com/rules/70_sare_oem.cf
wget&nbsp;http://www.rulesemporium.com/rules/72_sare_redirect_post3.0.0.cf
wget&nbsp;http://www.rulesemporium.com/rules/99_sare_fraud_post25x.cf
wget&nbsp;http://www.rulesemporium.com/rules/70_sare_genlsubj0.cf
</pre>
<h4>STEP 4 &#8211; Final step</h4>
<p>Finally, make sure your required score is still set to the default 5 because all the above rules expect that it hasn&#8217;t been changed.</p>
<pre class="brush: bash">
required_score 5.0
</pre>
<p>Once you&#8217;ve run your system with the above and you are comfortable with the results, you may automaticaly delete spam with a score of 8 or more. The safest way is to create a filter rule in cPanel (Mail -> Email Filtering):</p>
<p>Code:<br />
Select &#8220;Any header&#8221; that &#8220;contains&#8221; the string &#8220;X-Spam-Level: ********&#8221; (without quotes)</p>
<p>The result is this:</p>
<pre class="brush: bash">
$message_headers contains "X-Spam-Level: ********"
</pre>
<p>- END</p>
<p>I&#8217;ll add that if you have PLESK you can make this last change by editing the &#8216;spam filter&#8217; setting instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/finally-how-to-set-spamassasin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Transfer Horde emails to a new server</title>
		<link>http://www.klovera.com/transfer-horde-emails-to-a-new-server/</link>
		<comments>http://www.klovera.com/transfer-horde-emails-to-a-new-server/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 05:32:06 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Horde]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=163</guid>
		<description><![CDATA[We use Horde as one of the webmail solutions on our servers ( also using RoundCube and SquirrelMail ). Occasionally it becomes necessary to move the emails saved on the server to a new server or email account. This can easily be done with the Linux/Unix scp (secure copy) command. Here&#8217;s how to do it: [...]]]></description>
			<content:encoded><![CDATA[<p>We use <a href="http://horde.org">Horde</a> as one of the webmail solutions on our servers ( also using <a href="http://roundcube.net/">RoundCube</a> and <a href="http://squirrelmail.org/">SquirrelMail</a> ). Occasionally it becomes necessary to move the emails saved on the server to a new server or email account. This can easily be done with the Linux/Unix scp (secure copy) command.<br />
<span id="more-468"></span><br />
<strong>Here&#8217;s how to do it:</strong></p>
<ol>
<li>Copy all email and folders over to the new server using scp. Make sure the email you are copying to is already set up on the new server. Log into the old server via SSH and type the following:
<pre class="brush: bash">
scp -p -r -P [port] /var/qmail/mailnames/[domain]/[email] root@[IP of destination server]:/var/qmail/mailnames/[domain]/
</pre>
<p>You will be prompted for the root password of the server you are moving emails to. Once entered in you will view all the files being copied over.
</li>
<li>Log into the new server and change the ownership of the files moved. Before you do this the ownership will be root.root and will not show up if you log into Horde.
<pre class="brush: bash">
cd /var/qmail/mailnames/[domain]/[email]/
chown popuser:popuser *.* -R
</pre>
</li>
</ol>
<p>Done!</p>
<p><strong>Note:</strong> Not all servers are the same, so (like any SSH command) <em>do this at your own risk</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/transfer-horde-emails-to-a-new-server/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Changing the name of Horde</title>
		<link>http://www.klovera.com/changing-the-name-of-horde/</link>
		<comments>http://www.klovera.com/changing-the-name-of-horde/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 04:54:30 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Horde]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=151</guid>
		<description><![CDATA[If you use Horde 3 as the webmail client for your clients you may want to customize the name of the login page to something more friendly to your business. You can do so by editing the &#8216;registry.php&#8217; file in your configuration directory (on most my servers located at /etc/psa-horde/horde/). Toward the bottom you will [...]]]></description>
			<content:encoded><![CDATA[<p>If you use Horde 3 as the webmail client for your clients you may want to customize the name of the login page to something more friendly to your business. You can do so by editing the &#8216;registry.php&#8217; file in your configuration directory (on most my servers located at /etc/psa-horde/horde/). Toward the bottom you will find:</p>
<pre class="brush: php">
$this->applications['horde'] = array(
    'fileroot' => '/usr/share/psa-horde',
    'webroot' => $webroot,
    'initial_page' => 'login.php',
    'name' => _("Horde"),
    'status' => 'active',
    'templates' => '/usr/share/psa-horde/templates',
    'provides' => 'horde'
);
</pre>
<p>Change (&#8220;Horde&#8221;) to (&#8220;WhateverYouWant&#8221;). For me I changed it to (&#8220;DynamicMail&#8221;) seen below. </p>
<p><em>(Note: as of January 2010 Horde is no longer called DynamicMail on our servers)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/changing-the-name-of-horde/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Default Horde Theme</title>
		<link>http://www.klovera.com/default-horde-theme/</link>
		<comments>http://www.klovera.com/default-horde-theme/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 04:40:26 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[Horde]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=146</guid>
		<description><![CDATA[If you would like have a different default theme other than the &#8216;Blue and White&#8217; theme that ships with Horde 3 you can easily do so by editing the prefs.php located in the Horde conf-directory (on most my servers it is located at /etc/psa-horde/horde/). About 2/3rds of the way down in the file you will [...]]]></description>
			<content:encoded><![CDATA[<p>If you would like have a different default theme other than the &#8216;Blue and White&#8217; theme that ships with Horde 3 you can easily do so by editing the prefs.php located in the Horde conf-directory (on most my servers it is located at /etc/psa-horde/horde/). About 2/3rds of the way down in the file you will find:</p>
<pre class="brush: php">
// UI theme
$_prefs['theme'] = array(
    'value' => 'bluewhite',
    'locked' => false,
    'shared' => true,
    'type' => 'select',
    'desc' => _("Select your color scheme.")
);
</pre>
<p>Change &#8216;bluewhite&#8217; to the directory name of the theme you would like to use as the default. A great theme I use that does not ship with Horde is <a href="http://www.w8.se/horde/download">WPS Sober</a> found <a href="http://www.w8.se/horde/download">here</a> (read the README.txt in the download for installation directions). If you go with the WPS Sober you would change &#8216;bluewhite&#8217; to &#8216;wps_sober&#8217; after installing the theme.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/default-horde-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Practices for Coding HTML Emails</title>
		<link>http://www.klovera.com/best-practices-for-coding-html-emails/</link>
		<comments>http://www.klovera.com/best-practices-for-coding-html-emails/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 06:41:03 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Programming & Scripting]]></category>
		<category><![CDATA[Web Strategy]]></category>

		<guid isPermaLink="false">http://www.dustinsdesign.com/?p=97</guid>
		<description><![CDATA[If you are a web designer you know the pains of cross-browser coding. We currently have 3-4 popular browsers (IE6, IE7, FF, Safari) to keep in mind when creating new pages and each will interpret your code slightly different. This is the source of much hair pulling in the design community. However, shortly after delving [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.klovera.com/wp-content/uploads/2008/09/emailman.jpg" style="float:right;margin:0px 0px 10px 15px;" />If you are a web designer you know the pains of cross-browser coding. We currently have 3-4 popular browsers (IE6, IE7, FF, Safari) to keep in mind when creating new pages and each will interpret your code slightly different. This is the source of much hair pulling in the design community. However, shortly after delving into <em><strong>coding HTML emails</strong></em>, testing with 3-4 platforms starts looking inviting. Let me explain…</p>
<p>There are a wide range of tools available for viewing email; from software applications like Outlook, AOL, Lotus Notes, Eudora, etc. to web applications like Yahoo Mail, Google Mail, Hotmail and others. Each one of these has the potential of rendering your code differently and all have to be taken into account when coding your emails. So if you have any hair left, here are some ‘best practices’ you can follow to help keep your end users’ experience as uniform as possible.</p>
<p><span id="more-461"></span></p>
<ol>
<li><strong>Use tables to control your page layout instead of divs.</strong> You should be using divs and adhering to xhtml standards when coding for the web, but unfortunately this isn&#8217;t an option with email. Many email clients are years behind in css support so using old techniques are our only option. I know, I know, this is like nails on chalkboard for many of you. Note: percentage widths are best, but you may have to use a fixed width (don&#8217;t use 100% &#8211; use 98%, 90% or a fixed with)</li>
<li><strong>Do not use any css shorthand.</strong> Use individual properties.</li>
<li><strong>Use spans and divs sparingly.</strong></li>
<li><strong>Use attributes within the &lt;table&gt; and &lt;td&gt; tags to control display.</strong> Such as border=&#8221;", valign=&#8221;", align=&#8221;", cellpadding=&#8221;", cellspacing=&#8221;", background=&#8221;" etc.</li>
<li><strong>Use inline styles as much as possible.</strong> Some email clients will ignore anything in the &lt;head&gt; tag or even in the &lt;style&gt; tag. Yes, this can cause duplication in your code.</li>
<li><strong>Place your style information in the &lt;td&gt; tag closest to your content.</strong></li>
<li><strong>If you opt to use &lt;style&gt; to declare your css place it inside the &lt;body&gt; tag.</strong></li>
<li><strong>Do not use a <em>link</em> element to attach an external style sheet.</strong> It will be ignored in most cases.</li>
<li><strong>Test you email in web browsers and email clients.</strong> By testing in IE6, IE7, Firefox, Safari, etc. you will have a good start. Take it one step further by sending a test email out and checking it in as many email clients as you can get your hands on. The more popular ones were previously mentioned.</li>
<li><strong>Test your emails with images turned off.</strong> Many clients have the images turned off by default. If you have white text on a dark image and the image isn&#8217;t visible your email will look like a blank message.</li>
<li><strong>If you find a &#8216;phantom pixel&#8217; remove the spaces between your tag and the image.</strong> This is a legacy issue that is still around with some mail clients. If you are faced with this issue just make sure your tags have no spaces between them and are on the same line.</li>
<li><strong>Avoid using Javascript.</strong> Many clients will just ignore it.</li>
<li><strong>Don&#8217;t use 1&#215;1 pixels clear gif for spacing.</strong> Using this will increase the changes your email will be interpreted as spam.</li>
<li>Adhere to  <a href="http://www.ftc.gov/bcp/edu/pubs/business/ecommerce/bus61.shtm">CAN-SPAM rules</a>.</li>
</ol>
<h4>Resources</h4>
<ul>
<li>Check if your email registers as spam <a href="http://spamcheck.sitesell.com/">SpamCheck</a></li>
<li>HTML Email templates: <br /><a href="http://www.campaignmonitor.com/templates/">http://www.campaignmonitor.com/templates/</a><br /><a href="http://www.mailchimp.com/resources/templates/">http://www.mailchimp.com/resources/templates/</a></li>
<li>Very detailed article on this subject at sitepoint:<br />
<a href="http://www.sitepoint.com/article/code-html-email-newsletters/">http://www.sitepoint.com/article/code-html-email-newsletters/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.klovera.com/best-practices-for-coding-html-emails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

