Send email from Powershell with attachment
Posted by: SQL Server DBA,
on 07 Feb 2012 |
View original | Bookmarked: 0 time(s)
This post describes how to call to add an email attachment using Powershell.
In an earlier post - SQL Server Send email using Powershell the new-object Net.Mail.SmtpClient() Class was used.
To add an email attachment , use New-Object System.Net.Mail.MailMessage and New-Object System.Net.Mail.Attachment, which are part of the .Net Framework
The example script includes creating the variables, the function and calling the function .
$emailFrom = "jvamvas@sqlserver-dba.com"
$emailTo...