{"id":324,"date":"2011-06-13T14:41:00","date_gmt":"2011-06-13T14:41:00","guid":{"rendered":"https:\/\/www.geekmungus.co.uk\/?p=324"},"modified":"2022-11-05T10:53:42","modified_gmt":"2022-11-05T10:53:42","slug":"telnet-to-pop3-or-smtp-for-testing","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=324","title":{"rendered":"Telnet to POP3 or SMTP for Testing"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Email is a tricky thing to do right, though a couple of simple tools can help you test your mail server before you start to use it, i.e. make sure mail can be delivered correctly to a users mailbox. Also it can help diagnosing certain problems that you might have with your email.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">POP &#8211; Post Office Protocol is for recieving mail, this is the slightly simpler service to use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SMTP &#8211; Simple Mail Transfer Protocol, this is used for delivery of mail between mail servers. There are certain rules that are useful when diagnosing problems with SMTP servers, check out<a href=\"http:\/\/www.dnsstuff.com\/\"> www.dnsstuff.com<\/a> and also<a href=\"http:\/\/www.dnsreport.com\/\"> www.dnsreport.com<\/a> for more details.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For more information regarding how to use telnet to POP3 or SMTP see the sections below:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Telnet to POP3<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is possible, with many ISPs, to use a Telnet program to do maintenance on your mailbox on the POP3 mail server. This allows you to look at, and possibly delete, any problem causing message (e.g. too large to download, improperly formatted message, etc.)&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll be surprised how often this can happen especially if targeted by hackers who use &#8220;mail bombs&#8221; to fill up your inbox.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First load up a telnet client, such as the one included in windows. In Win &#8217;95, &#8217;98, click &#8220;Start&#8221; then &#8220;Run&#8221; then enter:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>telnet name.of.host portnumber<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">telnet = The name of the program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">name.of.host = The address of your mail server. (e.g. mail.fastisp.com)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">portnumber = The port used for mail, normally 110.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You may want to enable &#8220;local echo&#8221; so you can see what you are typing (quite handy!)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Now Connect&#8230;..<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Enter the above command substituting the correct server address and port number.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. You should now see this: &#8220;+OK InterMail POP3 server ready.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Type: &#8220;user yourusername&#8221; Where yourusername is your user name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Assuming that is accepted type : &#8220;pass yourpassword&#8221; where yourpassword is your password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. You should then see: &#8221; +OK yourusername is welcome here&#8221; or something like it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Now you can use the commands to edit your mail box see the list below:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>USER userid<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This must be the first command after the connect. Supply your e-mail userid (not the full e-mail address). Example: USER john.smith<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PASS password<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This must be the next command after USER. Supply your e-mail password. The password may be case sensitive.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following commands may be used as needed:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>STAT<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The response to this is: +OK #msgs #bytes Where #msgs is the number of messages in the mail box and #bytes is the total bytes used by all messages. Sample response: +OK 3 345910<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>LIST<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The response to this lists a line for each message with its number and size in bytes, ending with a period on a line by itself. Sample response:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">+OK 3 messages<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1 1205<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2 305<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3 344400<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>RETR msg#<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This sends message number msg# to you (displays on the Telnet screen). You probably don&#8217;t want to do this in Telnet (unless you have turned on Telnet logging). Example: RETR 2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>TOP msg# #lines<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is an optional POP3 command. Not all POP3 servers support it. It lists the header for msg# and the first #lines of the message text. For example, TOP 1 0 would list just the headers for message 1, where as TOP 1 5 would list the headers and first 5 lines of the message text.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>DELE msg#<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This marks message number msg# for deletion from the server. This is the way to get rid a problem causing message. It is not actually deleted until the QUIT command is issued. If you lose the connection to the mail server before issuing the QUIT command, the server should not delete any messages. Example: DELE 3<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>RSET<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This resets (unmarks) any messages previously marked for deletion in this session so that the QUIT command will not delete them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>QUIT<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This deletes any messages marked for deletion, and then logs you off of the mail server. This is the last command to use. This does not disconnect you from the ISP, just the mailbox.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Telnet to SMTP<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Telneting to SMTP is quite straight forward, though for this example will use the following email addreses etc:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sender Address: <em>bert@sendthatmail.com<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reciever Address: <em>jimmy@givememail.com<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reciever Mail Server: <em>mail.givememail.com<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Connecting to SMTP Port<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Telnet to port 25 using the following command: <strong>telnet mail.givememail.com 25<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are connected you should see something like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Trying A.B.C.D...\nConnected to mail.givememail.com.\nEscape character is '^]'.\n220 mail.givememail.com ESMTP Exim 4.04 Wed, 13 Nov 2002 16:27:42 -0700<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now you need to use the HELO command followed by the senders domain i.e. sendthatmail.com: <strong>helo sendthatmail.com<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now you have done that you should see:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>250 mail.givememail.com Hello sendthatmail.com &#91;E.F.G.H]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now you need to enter the &#8220;MAIL FROM:&#8221; command followed by the sender&#8217;s whole email address: <strong>mail from: bert@sendthatmail.com<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will then see:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>250 OK<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now put in the reciever address using the command: <strong>rcpt to: jimmy@givememail.com<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will then see:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>250 Accepted\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now you need to type in the mail message use the &#8220;DATA&#8221; command as shown below:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>data<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>354 Enter message, ending with &#8220;.&#8221; on a line by itself<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Subject:Test Message<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>This is a test message.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once completed you should see this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>250 OK id=18C6vd-0005Ey-00\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now when you are done, type in &#8220;QUIT&#8221; to end the session.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below is a quick summary that I found from the Internet regarding this, quite handy just for quick reference:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@Linux:\/> telnet mailhub.somedomain.com 25\nTrying A.B.C.D...\nConnected to mailhub.somedomain.com.\nEscape character is '^]'.\n220 mailhub.somedomain.com ESMTP Exim 4.04 Wed, 13 Nov 2002 16:27:42 -0700\nhelo someotherdomain.com\n250 mailhub.somedomain.com Hello someotherdomain.com &#91;E.F.G.H]\nmail from: Jim@someotherdomain.com\n250 OK\nrcpt to: Joe@somedomain.com\n250 Accepted\ndata\n354 Enter message, ending with \".\" on a line by itself\nSubject:Test Message\nThis is a test message.\n.\n250 OK id=18C6vd-0005Ey-00\nquit<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Email is a tricky thing to do right, though a couple of simple tools can help you test your mail server before you start to use it, i.e. make sure mail can be delivered correctly to a users mailbox. Also it can help diagnosing certain problems that you might have with your email. POP &#8211; &#8230; <a title=\"Telnet to POP3 or SMTP for Testing\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=324\" aria-label=\"Read more about Telnet to POP3 or SMTP for Testing\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-324","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=324"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/324\/revisions"}],"predecessor-version":[{"id":1564,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/324\/revisions\/1564"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}