Wednesday, June 25, 2014

Windows out of the box cmd send mail one liner with variables in subject/body

powershell -Command "Send-MailMessage -To to@recepient.com -Cc cc@recepient.com -From from@sender.com -SmtpServer 127.0.0.1 -Subject $('Mail from computer: ' + (hostname)) -Body $((date).ToString() + ' Mail from computer: ' + (hostname))

1 comment:

  1. Thanks! No need for me to install telnet now :)

    ReplyDelete