Question: Can anyone help me out, we need to send mail through command line from Window server. We cannot use Blat as per security issue and neither do we want to install Exchange resource kit. We have our own Mail exchange server we can make use of it.

May be if any batch which could be run to access our SMTP mail server.

Thanks in advance.

Answer: 
I got this resolved without using any SMTP clients. I used Windows Powershell script to send mail and it is working very well. 

Please check the below link 

<http://blogs.msdn.com/b/powershell/archive/2009/10/30/sending-automated-emails-with-send-mailmessage-convertto-html-and-the-powershellpack-s-taskscheduler-module.aspx>

Happy coding !!
**To send mail from command line in windows:-**  

Save this in a text file and name that file something like **sendmail.ps1**

```
$EmailFrom = "from@gmail.com"

$EmailTo = "to@domain.com"

$Subject = "The subject of your email"

$Body = "What do you want your email to say"

$SMTPServer = "smtp.gmail.com"

$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)

$SMTPClient.EnableSsl = $true

$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("gmail_username", "password");

$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

```

*-Don't forget to put the valid email address and password.*

Now open CMD and write this command 

> 
> Powershell -ExecutionPolicy ByPass -File C:\sendmail.ps1
> 
> 
> 

*Voila! mail sent!!*