<?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>Technical Diary &#187; mail</title>
	<atom:link href="http://andriigrytsenko.net/tag/mail/feed/" rel="self" type="application/rss+xml" />
	<link>http://andriigrytsenko.net</link>
	<description>With Andrii Grytsenko</description>
	<lastBuildDate>Tue, 17 Aug 2010 08:25:33 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Testing IMAP and POP3 servers over the telnet</title>
		<link>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/</link>
		<comments>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 12:49:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[pop3]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=456</guid>
		<description><![CDATA[Command list of IMAP and POP3 protocols. They can be used to test your server remotely over telnet connection.

Assume you set up pop3 and imap and want to check it out. 
POP3 
POP3 is quite simple protocol. I think you will make out how it&#8217;s work without any problem. 
First, let&#8217;s go to check the [...]]]></description>
			<content:encoded><![CDATA[<p>Command list of IMAP and POP3 protocols. They can be used to test your server remotely over telnet connection.<br />
<span id="more-456"></span></p>
<p>Assume you set up pop3 and imap and want to check it out. </p>
<p><center><strong>POP3 </strong></center><br />
POP3 is quite simple protocol. I think you will make out how it&#8217;s work without any problem. </p>
<p>First, let&#8217;s go to check the POP3 server. Make sure that it bound at port 110: </p>
<pre># netstat -lnp | grep 110
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      2779/dovecot</pre>
<p>As you can see I use dovecot as server application and it&#8217;s works on all interfaces.<br />
Next, make connection attempt:</p>
<pre># telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.</pre>
<p>Now, we got server answer. Do authorization with command <em>user</em> and <em>pass</em></p>
<pre>USER user1
+OK
PASS qwe
+OK Logged in.</pre>
<p>and <em>LIST</em> to see headers of all inbox mails:</p>
<pre>LIST
+OK 1 messages:
1 306
.</pre>
<p>We have only one mail. First field of answer means
<pre>mail_id</pre>
<p>.<br />
To see whole mail use <em>RETR mail_id</em>: </p>
<pre>RETR 1
+OK 306 octets
Return-Path: <fd@test.com>
Received: from d (node1 [10.0.30.1])
        by mail.test.com (8.13.8/8.13.8) with SMTP id n8ONtVLG011279
        for user1@test.com; Fri, 25 Sep 2009 03:04:08 +0300
Date: Fri, 25 Sep 2009 03:04:08 +0300
From: fd@test.com
Message-Id: <200909250004.n8ONtVLG011279@mail.test.com>
test</pre>
<p>To delete it:</p>
<pre>DELE 1
+OK Marked to be deleted.</pre>
<p>This message marked as deleted and will be removed when you send command <em>QUIT</em> to server. To unmark messages use command <em>RSET</em> without any arguments:</p>
<pre>RSET
+OK</pre>
<p>Use command <em>QUIT</em> to leave the server.</p>
<pre>QUIT
+OK Logging out.</pre>
<p>Refer to <a href="http://www.faqs.org/rfcs/rfc1939.html">RFC 1939</a> for more details.</p>
<p><center><strong>IMAP</strong></center><br />
By default IMAP listen port 143. Therefore let&#8217;s check it first:
<pre>
# netstat -lnp | grep 143
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      2779/dovecot</pre>
<p>Try to connect: </p>
<pre># telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
* OK Dovecot ready.</pre>
<p>Okay, we have got good answer. Now, we should authorize on server. Syntax is:<br />
<em>? LOGIN USER/ALIAS PASSWORD</em></p>
<p>For example:</p>
<pre>? login user1 qwe
? OK Logged in.</pre>
<p>To get folders list make: </p>
<pre>? LIST "" "*"
* LIST (\NoInferiors \UnMarked) "/" "INBOX"
? OK List completed.</pre>
<p>In folder INBOX contain all incoming messages. To select it: </p>
<pre>? SELECT INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 1 EXISTS
* 0 RECENT
* OK [UNSEEN 1] First unseen.
* OK [UIDVALIDITY 1253837819] UIDs valid
* OK [UIDNEXT 2] Predicted next UID
? OK [READ-WRITE] Select completed.</pre>
<p><em>1 EXISTS</em> &#8211; means 1 incoming message. You can choose between see full message or only message body instead:<br />
<em>? FETCH message_number All</em><br />
OR<br />
<em>? FETCH message_number Body</em></p>
<p>Let&#8217;s see whole message:</p>
<pre>? FETCH 1 all
* 1 FETCH (FLAGS () INTERNALDATE "25-Sep-2009 03:04:12 +0300" RFC822.SIZE 306 ENVELOPE ("Fri, 25 Sep 2009 03:04:08 +0300" NIL ((NIL NIL "fd" "test.com")) ((NIL NIL "fd" "test.com")) ((NIL NIL "fd" "test.com")) NIL NIL NIL NIL "<200909250004.n8ONtVLG011279@mail.test.com>"))
? OK Fetch completed.</pre>
<p>Exit user command  is <em>? LOGOUT</em>. </p>
<p>To learn more about IMAP refer to <a href="http://www.faqs.org/rfcs/rfc3501.html">RFC 3501</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
