{"id":3679,"date":"2019-11-28T01:37:24","date_gmt":"2019-11-27T23:37:24","guid":{"rendered":"https:\/\/www.msb365.blog\/?p=3679"},"modified":"2023-06-23T13:05:16","modified_gmt":"2023-06-23T11:05:16","slug":"telnet-email","status":"publish","type":"post","link":"https:\/\/www.msb365.blog\/?p=3679","title":{"rendered":"Use Telnet for sending e-mails"},"content":{"rendered":"<h3>Prolog<\/h3>\n<p>This article is about an old school topic. In the last few weeks after my vacation, I was supporting a company who had issues between a server and the mail environment to send emails.<\/p>\n<p>In this company, the messaging environment is configured that only authenticated systems are allowed to send messages. This I have configured threw a Kemp Load-balanced.<\/p>\n<p>\u00a0<\/p>\n<p>However, in the particular case one system was not able to send messages, from the messaging site the configuration was right. I recommended the service owner to try to send a mail using Telnet.<\/p>\n<p>It seems that Telnet is an old school method for testing and troubleshooting. The service owner did not know how to send mails using Telnet.<\/p>\n<p>Of course that is not bad, for this reason I will explain in this article how to use Telnet to send messages.<\/p>\n<p>\u00a0<\/p>\n<h3>On-premise<\/h3>\n<p>To use Telnet on an on-premise environment we need to start the command prompt on the system we want to test the connection.<br \/>\nIn the command prompt we type the command <strong>Telnet<\/strong> with the IP of the Exchange server and the Port you want to connect. By default the Port is 25, but in our example we are using the Port 587:<\/p>\n<pre class=\"\">telnet 10.54.69.32 587<\/pre>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-3726\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_1.png\" alt=\"\" width=\"1006\" height=\"446\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_1.png 1006w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_1-300x133.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_1-768x340.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_1-600x266.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_1-905x401.png 905w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>If Telnet is allowed on the right Port, we will be connected to the remote server, the answer we get can look like in the picture below:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-3727\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_2.png\" alt=\"\" width=\"1008\" height=\"448\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_2.png 1008w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_2-300x133.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_2-768x341.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_2-600x267.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_2-905x402.png 905w\" sizes=\"(max-width: 1008px) 100vw, 1008px\" \/><\/p>\n<p>Note: From now we are not allowed to make any typo mistakes. Otherwise we will need to start over again from the beginning.<\/p>\n<p>The remote Exchange Server is now ready to receive orders from us. We start with saying hello to the server:<\/p>\n<pre class=\"\">helo a<\/pre>\n<p>\u00a0<\/p>\n<p>Now we should receive a 2XX message from the remote Exchange, that shows us that we are allowed to communicate.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-3728\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_3.png\" alt=\"\" width=\"670\" height=\"219\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_3.png 670w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_3-300x98.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/Telnet_3-600x196.png 600w\" sizes=\"(max-width: 670px) 100vw, 670px\" \/><\/p>\n<p>In the next step we need to enter a sender address. This can be performed with the command:<\/p>\n<pre class=\"\">Mail from:alias@contoso.com<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3731\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/111-1.png\" alt=\"\" width=\"989\" height=\"228\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/111-1.png 989w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/111-1-300x69.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/111-1-768x177.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/111-1-600x138.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/111-1-905x209.png 905w\" sizes=\"(max-width: 989px) 100vw, 989px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>Now we need to enter the recipient, the command for that is:<\/p>\n<pre class=\"\">rcpt to:alias@fabrikam.net<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3732\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/222.png\" alt=\"\" width=\"993\" height=\"256\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/222.png 993w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/222-300x77.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/222-768x198.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/222-600x155.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/222-905x233.png 905w\" sizes=\"(max-width: 993px) 100vw, 993px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>The main things are now set, now we continue with the mail data. For that we run as first the command:<\/p>\n<pre class=\"\">Data<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3733\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/333.png\" alt=\"\" width=\"996\" height=\"84\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/333.png 996w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/333-300x25.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/333-768x65.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/333-600x51.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/333-905x76.png 905w\" sizes=\"(max-width: 996px) 100vw, 996px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>Now we need the Message subject, this can be enterd with the command:<\/p>\n<pre class=\"\">Subject:Testmail for documentation<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3734\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/4444.png\" alt=\"\" width=\"994\" height=\"78\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/4444.png 994w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/4444-300x24.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/4444-768x60.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/4444-600x47.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/4444-905x71.png 905w\" sizes=\"(max-width: 994px) 100vw, 994px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>In the next line we can now start writing the mail text we want to send. After we entered the subject and hit enter, we can start entering a text for the recipient.<br \/>\nTo finish the mail, we hit enter again and then a point \u201c.\u201d To tell the remote server that the mail is finished.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3735\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/5555.png\" alt=\"\" width=\"992\" height=\"154\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/5555.png 992w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/5555-300x47.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/5555-768x119.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/5555-600x93.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/5555-905x140.png 905w\" sizes=\"(max-width: 992px) 100vw, 992px\" \/><\/p>\n<p>In the end we only need to close the telnet session by entering <strong>quit<\/strong> and everything is done.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3736\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/6666.png\" alt=\"\" width=\"991\" height=\"135\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/6666.png 991w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/6666-300x41.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/6666-768x105.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/6666-600x82.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/6666-905x123.png 905w\" sizes=\"(max-width: 991px) 100vw, 991px\" \/><\/p>\n<p>A few moment later I have received the email we just have sent threw telnet.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3738\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/777.png\" alt=\"\" width=\"1029\" height=\"54\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/777.png 1029w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/777-300x16.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/777-768x40.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/777-1024x54.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/777-600x31.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/777-905x47.png 905w\" sizes=\"(max-width: 1029px) 100vw, 1029px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>With this test I was able to prove the service owner, that from the messaging site everything is working fine. So he had to find the issue on an other place.<\/p>\n<p>\u00a0<\/p>\n<h3>Exchange Online<\/h3>\n<p>If we are using Exchang online, we are also able to create a telnet session. To do that we can follow the similar steps. First of all, we need to get a connection to our Exchange online tenant using telnet. In this example I will use the Exchange online from the MSB365 Tenant:<\/p>\n<p>We need to open a command prompt and type the Telnet command using the syntax bellow:<\/p>\n<pre class=\"\">Telnet yourtenant-com.mail.protection.outlook.com 25<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3739\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/123456.png\" alt=\"\" width=\"993\" height=\"128\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/123456.png 993w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/123456-300x39.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/123456-768x99.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/123456-600x77.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/123456-905x117.png 905w\" sizes=\"(max-width: 993px) 100vw, 993px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>In the following screenshot, we can see the result, the answer from the EOP server appears on the screen:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3740\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/0123456.png\" alt=\"\" width=\"995\" height=\"114\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/0123456.png 995w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/0123456-300x34.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/0123456-768x88.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/0123456-600x69.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/10\/0123456-905x104.png 905w\" sizes=\"(max-width: 995px) 100vw, 995px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>From this point we can use the same commands to send emails like we saw in the previous chapter.<\/p>\n<p>\u00a0<\/p>\n<h3>Conclusion<\/h3>\n<p>First of all note: Telnet is only working if the security is set to allow this type of connection. If you are not able to connect a server by using Telnet the reason can be that the IP is wrong or Telnet is not permitted.<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>Photo by\u00a0<a href=\"https:\/\/unsplash.com\/@benwhitephotography?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText\">Ben White<\/a>\u00a0on\u00a0<a href=\"https:\/\/unsplash.com\/search\/photos\/talking?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText\">Unsplash<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prolog This article is about an old school topic. In the last few weeks after my vacation, I was supporting a company who had issues between a server and the mail environment to send emails. In this company, the messaging environment is configured that only authenticated systems are allowed to send messages. This I have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3686,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1923,2],"tags":[],"class_list":["post-3679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-365","category-exchange"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/3679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3679"}],"version-history":[{"count":6,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/3679\/revisions"}],"predecessor-version":[{"id":5182,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/3679\/revisions\/5182"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/media\/3686"}],"wp:attachment":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}