Practice
Here is a little script that sends a letter to a recipient specified in its body, with a predefined subject and body text. For example, it can be used to automatically send emails in response to certain events.
mysendmail.ps1
I think everything is clear from the text. In the variable "$SmtpServer", put the address of your SMTP server.
If you want to send emails from other scripts or on a schedule, you'll need to create one more file - a VBS file. The thing is that, for security reasons, PowerShell scripts can't just be run directly, but we can take a workaround - run a VisualBasic script that will in turn launch our desired PS1 script.
mysendmail.vbs
Comments