Use telnet to test SMTP Communication

Source: Internet
Author: User
Tags rfc mx record nslookup nslookup command fully qualified domain name

 

This topic describes how to use Telnet to test the Simple Mail Transfer Protocol (SMTP) communication between mail servers. By default, SMTP listens on port 25. If Telnet is used on port 25, you can enter the SMTP command to connect to the SMTP server and use the Telnet session as the SMTP mail server to send emails. You can also check whether each step is successful or failed during the connection and email submission processes.

In the following scenarios, you may need to use Telnet to test SMTP communication sent to or from a transport server in the MicrosoftExchangeServer organization:

  • Connect to the edge transport server of the organization from a host outside the peripheral network and send a test email.
  • Connect to the remote email server from the edge transport server of the Organization and send a test email.

The steps in this topic show how to use the Telnet client component included in Microsoft Windows. The third-party Telnet client may need a different syntax from the WindowsTelnet component.

 

 

Prerequisites

 

 

  • Configure accept connector to allow anonymous access or Basic AuthenticationBecause the normal email transmission between hub transport servers is encrypted and authenticated, when Telnet is used to test communication on port 25, the internal hub transport server should configure the accept connector to allow anonymous access or basic authentication to receive mail. Internet-oriented servers require anonymous access.

    Note:
    When sending an email to a receiving connector that accepts basic identity authentication, you must have a utility that converts text strings used for usernames and passwords to Base64 format. Because the user name and password are easily identified during basic authentication, it is not recommended to use basic unencrypted authentication.

  • Connect to the remote email serverYou may also need to connect to the remote email server from the edge transport server of your organization. For an Internet-oriented SMTP server, if it is configured to verify the source IP address, the corresponding Domain Name System (DNS) domain name, and the reverse lookup IP address of all Internet hosts that attempt to send emails to the server, this helps avoid rejection of test emails.
  • Install and/or enable the Telnet ClientBefore using Telnet to test SMTP communication between email servers, you may need to perform one or more of the following tasks:
    • Install the Telnet client ). For more information about how to install the Telnet client on Windows Vista or Windows Server 2008, see install the Telnet client.
    • Enable the Telnet client on Windows Server 2008. See the steps following this topic.
  • Find the FQDN or IP address of the SMTP server. If you do not know the FQDN or IP address, you can use Nslookup to find the FQDN or IP address of the SMTP server. See the steps following this topic.

 

Enable the Telnet client in Windows Server 2008

 

 

The minimum requirement for completing this step is a member or equivalent of the WindowsServer2008 Local Administrators Group.

In WindowsServer2008, the Telnet client is disabled by default. To enable it, perform the following steps:

 

Use Nslookup to find the FQDN or IP address of the SMTP server

 

 

To connect to the target SMTP server using Telnet port 25, you must use the Fully Qualified Domain Name (FQDN) or IP address of the SMTP server. If the FQDN or IP address is unknown, the easiest way to find this information is to use the Nslookup command line tool to find the MX record of the target domain.

Note:
Firewall or Internet proxy restrictions set by the internal network of the Organization may prevent you from using Nslookup to query public DNS servers on the Internet. MX records are not absolutely required for internal mail flows within the Exchange organization. If you want to find the FQDN of any hub transport server or subscribed edge transport server in your organization, you can use the following commands in the Exchange command line management program:Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isEdgeServer -eq $true} | Format-List Fqdn,ServerRoleFor more information, see Get-ExchangeServer and MTS.

 

 

Use Telnet on port 25 to test SMTP Communication

 

 

To provide an example, the following steps use the values described in the following table:

  • Target SMTP ServerMail1.fabrikam.com
  • Source DomainContoso.com
  • Sender's email addressChris@contoso.com
  • Recipient's email addressKate@fabrikam.com
  • Email SubjectTest from Contoso
  • Email bodyThis is a test email.

    Note:
    Valid sender email addresses should always be used to deliver the non-delivery report (NDR) mail generated by the target SMTP server to the sender.

Commands in the Telnet client are case-insensitive. For clarity, SMTP command verbs use uppercase letters.

 

 

Evaluate Telnet session results

 

 

This section provides the response information for the following commands used in the preceding example:

  • Open mail1.fabrikam.com 25
  • EHLO contoso.com
  • Mail from: chris@contoso.com
  • Rcpt to: kate@fabrikam.com venture y = success, failure

    Note:
    The three-digit SMTP response code defined in RFC 2821 is the same for all SMTP mail servers. For some SMTP mail servers, text descriptions may be slightly different. In the previous example, the target computer runs ExchangeServer2010.

 

Open mail1.fabrikam.com 25

 

 

Successful response:220 mail1.fabrikam.com Microsoft ESMTP MAIL Service ready at <day-date-time>

Failure response:Connecting to mail1.fabrikam.com...Could not open connection to the host, on port 25: Connect failed

Possible causes of failure

  • The target SMTP service is unavailable.
  • Limits the target firewall.
  • Limits the source firewall.
  • The FQDN or IP address of the specified destination SMTP server is incorrect.
  • The specified port number is incorrect.

 

EHLO contoso.com

 

 

Successful response:250 mail1.fabrikam.com Hello [<sourceIPaddress>]

Failure response:501 5.5.4 Invalid domain name

Possible causes of failure: Invalid characters exist in the domain name. Or, there is a connection restriction on the target SMTP server.

Note:
EHLO is an extended Simple Mail Transfer Protocol (ESMTP) command verb defined in RFC 2821. The ESMTP server can publish its functions during initial connection. These features include the maximum acceptable email size and the authentication methods they support. HELO is the old SMTP command verb defined in RFC 821. Most SMTP mail servers support ESMTP and EHLO.

 

Mail from: chris@contoso.com

 

 

Successful response:250 2.1.0 Sender OK

Failure response:550 5.1.7 Invalid address

Possible causes of failure: The sender's email address has a syntax error.

Failure response:530 5.7.1 Client was not authenticated

Possible causes of failure: The target server does not accept anonymous email submissions. If you attempt to use Telnet to directly submit an email to the Hub transport server, you will receive this error message.

 

Rcpt to: kate@fabrikam.com venture y = success, failure

 

 

Successful response:250 2.1.5 Recipient OK

Failure response:550 5.1.1 User unknown

Possible causes of failure: The specified recipient does not exist in the Organization.

Original article address

View more articles

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.