Tuesday, 3 March 2015

Use Powershell to send mail.

Use Powershell to send mail.

You need not bang your head with vbs scripts nor the executable/programs that send mail and cause worry to the security guys in your domain.


PowerShell has the most easiest way to send mail from console and not to mention we should be aware which one is the outgoing smtp server.

Send-MailMessage -To username@somedomain.com -Body 'Mail Body' -Subject 'Sending mail from PowerShell' -from'someuser@somedomain.com' -SmtpServer 'smtp.yoursmtpserver.com' -Attachment 'path of the attachment'


Isn't it easy? than downloading scripts that we didn't author and executing them on internal servers. :)

Give it a try...

No comments:

Post a Comment