Skip to content

Instantly share code, notes, and snippets.

@vaderj
Last active June 11, 2018 20:35
Show Gist options
  • Save vaderj/de147f3d00c06eefc539528864a53120 to your computer and use it in GitHub Desktop.
Save vaderj/de147f3d00c06eefc539528864a53120 to your computer and use it in GitHub Desktop.
Email a file to one or more users via PowerShell #PowerShell
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