<?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>PoundBangWhack.com &#187; Email</title>
	<atom:link href="http://www.poundbangwhack.com/category/email/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.poundbangwhack.com</link>
	<description>A web development/programming blog providing info, tips, and tricks on programming languages, scripting, Linux, MySQL and more</description>
	<lastBuildDate>Sat, 17 Jul 2010 05:17:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Read Email Headers</title>
		<link>http://www.poundbangwhack.com/2009/06/19/how-to-read-email-headers/</link>
		<comments>http://www.poundbangwhack.com/2009/06/19/how-to-read-email-headers/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 05:10:59 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=814</guid>
		<description><![CDATA[Sooner or later, people who run their own server, or email server, are going to run into email issues.  In earlier posts, I discussed how to configure an alternate port for Qmail as well as how to test if your email server is working.  This post touches on <strong>how to read email headers</strong> which can be useful when your email delivery is delayed to find out where the delay is occurring.]]></description>
			<content:encoded><![CDATA[<p>Sooner or later, people who run their own server, or email server, are going to run into email issues.  In earlier posts, I discussed <a href="http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/">how to configure an alternate port for Qmail</a> as well as <a href="http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/">how to test if your email server is working.</a>  This post touches on <strong>how to read email headers</strong> which can be useful when your email delivery is delayed to find out where the delay is occurring.<br />
<span id="more-814"></span><br />
The first thing about reading email headers, is that they read backwards &#8211; bottom to top.  Each new entry in the headers get&#8217;s added at the top as the headers continue to grow.  Now, the majority of the information you want to look at when troubleshooting a delivery delay is in the <strong>Received</strong> sections.  The information above and below that, while useful for other purposes, is not really necessary for what we&#8217;re looking for here.  For an example, I have provided the headers from a test email I sent between two different accounts I have on two different mail servers.  I have stricken out the information I was discussing above that is not necessary to us:</p>
<p><code><strike>From - Mon Jun 22 15:43:01 2009<br />
X-Account-Key: account6<br />
X-UIDL: UID52-1242085352<br />
X-Mozilla-Status: 0001<br />
X-Mozilla-Status2: 00000000<br />
X-Mozilla-Keys:</strike><br />
Received: (qmail 11994 invoked from network); 22 Jun 2009 15:42:58 -0700<br />
Received: from smtpauth01.prod.mesa1.secureserver.net (64.202.165.181)<br />
  by ip-97-74-114-123.ip.secureserver.net with SMTP; 22 Jun 2009 15:42:58 -0700<br />
Received: (qmail 12509 invoked from network); 22 Jun 2009 22:42:57 -0000<br />
Received: from unknown (172.21.44.241)<br />
  by smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) with ESMTP; 22 Jun 2009 22:42:57 -0000<br />
Message-ID: &lt;4A4008F1.8020205@desertwebdesigns.com&gt;<br />
Date: Mon, 22 Jun 2009 15:42:57 -0700<br />
<strike>From: Mark Stoecker &lt;webmaster@desertwebdesigns.com&gt;<br />
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)<br />
MIME-Version: 1.0<br />
To: admin@poundbangwhack.com<br />
Subject: Test Email<br />
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br />
Content-Transfer-Encoding: 7bit</strike></code></p>
<p>When troubleshooting email delays, the first thing you want to do is get all your times in the same time zone.  Some servers will timestamp based on their current time, some will timestamp based on <acronym title="Greenwich Mean Time">GMT.</acronym>  It will be easier to read if they are all the same timezone.  In the example above, there are 6 timestamps we need to be concerned with, 2 of which are in <acronym title="Greenwich Mean Time">GMT.</acronym></p>
<p>After getting all your times sorted out, the next thing you want to do is follow the delivery path (from bottom to top).  Each server that the message passes through will stamp it.  The tricky thing about reading the <span class="pre">Received:</span> lines is that they list first the sender, then the recipient: <code>Received: from smtpauth01.prod.mesa1.secureserver.net (64.202.165.181)<br />
  by ip-97-74-114-123.ip.secureserver.net with SMTP; 22 Jun 2009 15:42:58 -0700</code>  As you can see here, the message was received <strong>from</strong> smtpauth01.prod.mesa1.secureserver.net <strong>by</strong> ip-97-74-114-123.ip.secureserver.net.  If this gets confusing, just rearrange it to make it easier: <code>Received <strong>by</strong> ip-97-74-114-123.ip.secureserver.net <strong>from</strong> smtpauth01.prod.mesa1.secureserver.net</code>  Now it makes a bit more sense.  </p>
<p>So if we were to take the critical delivery points in the chain, fix the timestamps, rearrange the delivery notices, and re-order the server stamps so it reads top-to-bottom like we do, our headers would read something like this:<code>Date: Mon, 22 Jun 2009 <strong>15:42:57</strong> -0700<br />
Received: by smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) from unknown (172.21.44.241) with ESMTP @ 22 Jun 2009 <strong>15:42:57</strong> -0700<br />
Received: (qmail 12509 invoked from network) @ 22 Jun 2009 <strong>15:42:57</strong> -0700<br />
Received: by ip-97-74-114-123.ip.secureserver.net from smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) with SMTP @ 22 Jun 2009 <strong>15:42:58</strong> -0700<br />
Received: (qmail 11994 invoked from network) @ 22 Jun 2009 <strong>15:42:58</strong> -0700<br />
From - Mon Jun 22 <strong>15:43:01</strong> 2009</code>  If you compare the two &#8220;headers&#8221; carefully, you will see that all I did was change the timestamps to MST, swap the &#8220;Received From&#8221; and &#8220;Received By&#8221;, and ordered them top-to-bottom instead of bottom-to-top.  Looking at the headers now, there was obviously no delay in this message.  However, had one of the timestamps been off by 30-40+ minutes, looking at the headers this way will help us determine where the delay is.  We would know that when the message came in late at one step, the server it came from is having the problem.</p>
<p>There are plenty of other uses for reviewing mail headers that are too numerous to count in this post.  However, if you&#8217;re email is not delivering in a timely manner, this will help you track down the cause.  Once you get the hang of reading email headers, you&#8217;ll be able to read them as they&#8217;re printed without having to rewrite them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/19/how-to-read-email-headers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Configure an Alternate Port for Qmail</title>
		<link>http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/</link>
		<comments>http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 14:00:31 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[Qmail]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=628</guid>
		<description><![CDATA[A couple days ago I wrote about <a href="http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/">how to troubleshoot an email server when it isn't working</a>.  This post isn't necessarily follow-up to that, but more of a corollary.  One of the things I didn't mention in that post is what to do if you are running an email server and your <acronym title="Internet Service Provider">ISP</acronym> does not allow outgoing connections over port 25, the standard <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> port.  Many <acronym title="Internet Service Provider">ISP's</acronym> have this policy to cust down on Spam sent through their servers, mine included.  So when I tried to connect to my email the other day through Mozilla Thunderbird, I ran into a problem.  I knew what I had to do.  I had to <strong>configure Qmail to use an alternate port.</strong>]]></description>
			<content:encoded><![CDATA[<p class="post_ad_box"><!--Adsense1--></p>
<p><em>I had initially posted instructions on how to change the default Qmail port.  However, an associate of mine pointed out the fallacy in my instructions.  Changing the default Qmail port will prevent email from being delivered to your server as foreign mail servers will try to connect to your server on port 25 and if you change it, you won&#8217;t be able to receive email.  I completely forgot about that little side effect when I posted this and have thus changed this post to only show <strong>how to configure an alternate port for Qmail.</strong></em></p>
<p>A couple days ago I wrote about <a href="http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/">how to troubleshoot an email server when it isn&#8217;t working</a>.  This post isn&#8217;t necessarily follow-up to that, but more of a corollary.  One of the things I didn&#8217;t mention in that post is what to do if you are running an email server and your <acronym title="Internet Service Provider">ISP</acronym> does not allow outgoing connections over port 25, the standard <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> port.  Many <acronym title="Internet Service Provider">ISP&#8217;s</acronym> have this policy to cust down on Spam sent through their servers, mine included.  So when I tried to connect to my email the other day through <a href="http://www.mozillamessaging.com/en-US/thunderbird/" target="_blank" title="Mozilla Thunderbird">Mozilla Thunderbird</a>, I ran into a problem.  I knew what I had to do.  I had to <strong>configure Qmail to use an alternate port.</strong><br />
<span id="more-628"></span><br />
The first thing you will need to do is locate the service script for your email service.  In my case, since I use <a href="http://www.qmailrocks.org/" target="_blank" title="QmailRocks.org">Qmail</a> with <a href="http://www.parallels.com" target="_blank" title="Plesk Home">Plesk</a>, my script was located at <strong>/etc/xinetd.d/smtp_psa</strong>.  You will most likely have another one for <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> over <acronym title="Secure Sockets Layer">SSL</acronym> named smtps_psa (or something close to).  Next, you need to see what ports your server is currently listening on so you do not assign it to the same port as another service and cause problems.  To do that, run the following command<br />
<code>netstat -tulpn | grep tcp</code>  That will show all current running services, the port their using, and filter out <acronym title="Transmission Control Protocol">TCP</acronym> only (so as not to see duplicate ports in the <acronym title="User Datagram Protocol">UDP</acronym> section.  You will be concerned with the column labeled &#8220;Local Address&#8221; as that will show the IP (0:0:0:0 or ::: means all IPs) and the port in use.  Pick a random port number not in use for your <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> configuration.  I chose 2525.</p>
<h3>How to configure Qmail to use an alternate port</h3>
<p>To configure an alternate qmail port, you will need to first copy the default smtp service file to create an alternate configuration.  I did this with the following code <code>cp /etc/xinetd.d/smtp_psa /etc/xinetd.d/smtp_alt_psa</code>  You will then need to open your alternate service file and configure the alternate service name.  Using a text editor of your choice (I like vi), type <code>vi /etc/xinetd.d/smtp_alt_psa</code>  The first line should look something like <code>service smtp</code>  That line will need to be changed so we don&#8217;t have two services with the same name.  Hit <em>i</em> to enter insert mode and change the first line to read <code>service smtp_alt</code>  Hit <em>Esc</em>, type <span class="pre">:wq</span> to write and quit.</p>
<p>We now need to edit the <strong>/etc/services</strong> file to set the port.  Make sure the service name you use matches the service name you entered in the alternate configuration file above.  I added these lines right below the original <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> lines.  Hit <em>i</em> again for insert mode and write in the two following lines <code>smtp_alt        2525/tcp        mail<br />
  smtp_alt        2525/udp        mail</code>  Your <strong>/etc/services</strong> file should look something like this <code>smtp            25/tcp          mail<br />
smtp            25/udp          mail<br />
smtp_alt        2525/tcp        mail<br />
smtp_alt        2525/udp        mail</code>  Hit <em>Esc</em>, type <span class="pre">:wq</span> to write and quit.  Now restart your email service.  Again, here was my code to do that <code>service xinetd restart</code>  Run the <span class="pre">netstat -tulpn | grep tcp</span> command again to verify that your email service is now listening on port 25 and 2525.</p>
<p>That&#8217;s all there is to it.  You should now be able to connect through your email client to your server on your alternate port.  Questions? Comments? Problems? Post them below and I&#8217;ll do my best to help out.</p>
<p><em>For more help on using the vi/vim text editor, visit our <a href="http://www.poundbangwhack.com/linux-command-line-cheat-sheet/">Linux command line cheat sheet</a> with extensive information on using vi.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>2 SUREFIRE ways to test if your email is working</title>
		<link>http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/</link>
		<comments>http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 05:30:32 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Remote Desktop]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=546</guid>
		<description><![CDATA[By and large, the biggest problem I see day in and day out is email related.  Now granted, their are plenty of legitimate issues, things like getting flagged by a relay server's spam filter or the relay server not accepting communications from a server.  Those aren't things a customer can do anything about.  However, it is my firm belief that if you have a problem, you probably aren't the first person in the world who's had that problem.  If you are, lucky you...and that sucks.  Throw the error message (or description of the problem) into google and see what you come up with.  The answer is often on the first page.  Spend 10 minutes looking for a solution in google, and you'll probably find it. But most people would rather send in a ticket and wait 2, 3, 4, or more hours for us to fix it, or tell them how to fix it.]]></description>
			<content:encoded><![CDATA[<p class="post_ad_box"><!--Adsense1--></p>
<p>We&#8217;ve all ran into those problems where all of our sudden, we can&#8217;t send email and we don&#8217;t know why, and don&#8217;t know what to do, besides call our email provider.  One thing I&#8217;ve been focusing on at work lately is empowering our customers to &#8220;take ownership&#8221; of their servers, to help them figure things out on their own.  The way I put it, <strong>being a server administrator is like getting married;</strong> &#8220;through good times and bad.&#8221;  The problem is most administrators (or wannabe administrators) only want to be the admin when the server is running.  Once there&#8217;s a problem, they expect us to be the admin.  Sorry folks, but that&#8217;s not how it works.<br />
<span id="more-546"></span></p>
<h3>Troubleshooting Email Issues</h3>
<p>By and large, the biggest problem I see day in and day out is email related.  Now granted, their are plenty of legitimate issues, things like getting flagged by a relay server&#8217;s spam filter or the relay server not accepting communications from a server.  Those aren&#8217;t things a customer can do anything about.  However, it is my firm belief that if you have a problem, you probably aren&#8217;t the first person in the world who&#8217;s had that problem.  If you are, lucky you&#8230;and that sucks.  Throw the error message (or description of the problem) into google and see what you come up with.  The answer is often on the first page.  Spend 10 minutes looking for a solution in google, and you&#8217;ll probably find it. But most people would rather send in a ticket and wait 2, 3, 4, or more hours for us to fix it, or tell them how to fix it.</p>
<p>So how can you tell if your email is really broken or not?  Let me first say this guide is for people who use a hosted email service, not a free email service like Hotmail, Yahoo Mail, or Gmail.  It may not even work if you are using a shared mail server through a large email provider.  This will work best for you if you are using a virtual dedicated (virtual private) or dedicated (private) server that utilizes it&#8217;s own mail service independent of other users.  </p>
<h3>Remove all variables from the equation</h3>
<p>Let&#8217;s say you can&#8217;t send your email out through Thunderbird (or Outlook if you choose to go that route).  <strong>Regardless of the error you&#8217;re getting, try your webmail first.</strong>  If it works through webmail, this will tell you if your mail service is at least working.  Your webmail is going to use the same SMTP service that your mail client will.  Chances are if you can send through webmail, the problem is local, either with your mail client configuration, or your ISP.  If this is the case <strong>call your ISP</strong>.  Many ISP&#8217;s will block outgoing communications on port 25, the standard SMTP port.  This was the case with my ISP so I had to configure my Qmail to use an alternate port (but that&#8217;s another post &#8211; look online for the time being).  Assuming all your settings are correct in your mail client (you&#8217;d be surprised how often this is the problem), we know it&#8217;s not a local issue.  So you can&#8217;t send at all.  Is it your local server? Or does your provider make you go through a relay server and that&#8217;s the problem?  <strong>The best tool to troubleshoot your email is <a href="http://en.wikipedia.org/wiki/Telnet" target="_blank">telnet</a>.</strong>  </p>
<h3>Sending email through telnet</h3>
<p>The first <strong>surefire way to test your email is by sending email through a telnet to localhost.</strong>  This means connecting to your server either via <acronym title="Secure Shell">SSH</acronym> for Linux or Remote Desktop for Windows.  If you are using Windows, open a command prompt first.  At that point, the process is the same for Linux or Windows.  Now, a few people will try this on their own, but often fail.  The reason is that their email headers are not <acronym title="Request for Comments">RFC</acronym> compliant.  <strong>Here is how to send a test email through telnet.</strong>  Note: Your output may not be exactly the same as below.  The bold code is the end user input, the italicized code is variable input/output.<br />
<code><strong>telnet localhost 25</strong><br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
220 <em>servername</em> ESMTP<br />
<strong>HELO localhost</strong><br />
250 <em>servername</em><br />
<strong>MAIL FROM: <em>email address on your server</em></strong><br />
250 ok<br />
<strong>RCPT TO: <em>email address your sending to (off your server)</em></strong><br />
250 ok<br />
<strong>DATA</strong><br />
354 go ahead<br />
<strong>from: <em>from address</em></strong><br />
<strong>to: <em>to address</em></strong><br />
<strong>subject: <em>any subject</em></strong><br />
<strong>body of message</strong><br />
<span style="line-height: 1.4em;"></span><br />
<strong>.</strong><br />
<span style="line-height: 1.4em;"></span><br />
250 ok <em>1244530643 qp 9552</em><br />
</code><br />
A few notes, the data entry should be in the specific order above.  There should be an empty line before and after the body of your message.  End your message with a period to send it.  The <em>250 ok</em> line at the end means that the message was entered into your local mail queue. Check your from address for a bouceback message.  No bounceback message means the message delivered ok.</p>
<h3>Was the message accepted or did you get a bounceback?</h3>
<p>If the message comes back, the second <strong>surefire way to test your email is by sending email through a telnet to your relay server.</strong>  The process is the exact same as above, however replace localhost with your relay server&#8217;s name and follow the same steps. If the message is not accepted, contact your hosting provider.  If it is accepted, check your from address for a bounceback message.</p>
<p>Either way, if you get a bounceback message, the first thing you should do is <strong>look at the bounceback error code.</strong>  The error code will tell you the problem.  Take that error code and put it into a search engine for additional information.  You most common codes will be 553 or 554 (more on these in another post).  </p>
<p>The bottom line is, test your email server through telnet first before assuming there&#8217;s a problem.  Telnet will connect directly to the server on the specified port and will eliminate all external factors in troubleshooting the issue.  Email issues are not as complicated to troubleshoot as most people believe.  They just take a bit of time and patience.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
