How To Check If Email Host Is Available

How to check if email host is available?

Follow the below Steps,

Approach #1:
  1. Open up a command prompt (CMD.exe)
  2. Type nslookup and hit enter
  3. Type set type=MX and hit enter
  4. Type the domain name and hit enter, for example: google.com
  5. The results will be a list of host names that are set up for SMTP

If no answer is received from DNS server, there is a good chance that there is no SMTP Servers set up for that domain.

Approach #2:
Approach #3:
  • Telnet to SMTP server like

    telnet smtp.mydomain.com 25
    

    Syntax :

    telnet {smtp_domain_name} {port_number}
    

    And copy and paste the below

    helo your_domain.com
    mail from:
    rcpt to:
    data
    From: test@your_domain.com
    Subject: test mail from command line
    
    this is test number 1
    sent from linux box
    .
    

    Note: Do not forgot the "." at the end which represents the end of the message

  • Powershell commands to send Email
    • $From = "YourEmail@gmail.com"
      $To = "AnotherEmail@YourDomain.com"
      $Cc = "YourBoss@YourDomain.com"
      $Attachment = "C:\temp\Some random file.txt"
      $Subject = "Email Subject"
      $Body = "Insert body text here"
      $SMTPServer = "smtp.gmail.com"
      $SMTPPort = "587"
      Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
      -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl `
      -Credential (Get-Credential) -Attachments $Attachment