Last active
June 11, 2018 20:35
-
-
Save vaderj/de147f3d00c06eefc539528864a53120 to your computer and use it in GitHub Desktop.
Email a file to one or more users via PowerShell #PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function emailResults() | |
{ | |
$fromEmail = "[email protected]" ; | |
$toEmail = "[email protected]","[email protected]"; | |
$smtp = "mail.domain.local" ; | |
$mailSubject = "Top search queries for the week of " + $curDate ; | |
$mailMsg = "<html><body><p> Please see the attached for this weeks top search queries</p> | |
<p> This script runs weekly </p> | |
<p> If you would like to see any changes to this email, please contac the team : <a href='[email protected]'>[email protected]</a></p> </body> </html> " ; | |
Send-MailMessage -to $toEmail -from $fromemail -subject $mailsubject -Attachments $fileName -body $mailMsg -bodyAsHTML -smtp $smtp ; | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment