How to check if email host is available?
Follow the below Steps,
Approach #1:- Open up a command prompt (CMD.exe)
- Type nslookup and hit enter
- Type set type=MX and hit enter
- Type the domain name and hit enter, for example: google.com
- 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.
-
Generally SMTP servers name are smtp.yourdomain.com or mail.yourdomain.com , Open command prompt and try to run following two commands
- >ping smtp.yourdomain.com
- >ping mail.yourdomain.com
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
- $From = "YourEmail@gmail.com"