I've written a Powershell script that sends out an email, but I'm trying figure out a way to add an AIP classification to it. My organization uses general classifications of:
Public
Internal
Secret
Since in this case the classification is Internal I just need a way to set that in my script. My current script (using Office 365) is:
$message = New-Object Net.Mail.MailMessage
$emailTo = 'user1@domain.tld'
$emailFrom = 'user2@domain.tld'
$emailCc = 'user3@domain.tld'
$smtpServer = 'smtp.domain.tld'
$subject = "Report"
$body = @"
<p><font face = "Calibri" size = "3">Hello,</p>
<p>Please see report.</p>
<br/><br/><font face = "Tempus Sans ITC" size = "3">User 2
<br/>123 Maple Road
<br/>(555) 555-5555 Office
<br/>user2@domain.tld</font>
<br/><br/><img src="cid:attlogo">
"@
$smtp = New-Object Net.Mail.SmtpClient
$smtp.Host = $smtpServer
$smtp.EnableSsl = $true
$logo = "C:\logo.png"
$attlogo = New-Object System.Net.Mail.Attachment($logo)
$attlogo.ContentDisposition.Inline = $True
$attlogo.ContentDisposition.DispositionType = "Inline"
$attlogo.ContentType.MediaType = "image/png"
$attlogo.contentID = "attlogo"
$message.From = $emailFrom
$message.To.Add($emailTo)
$message.Cc.Add($emailCc)
$message.Subject = $subject
$message.Body = $body
$message.IsBodyHtml = $true
$message.Attachments.Add($attlogo)
$smtp.Send($message)
$attlogo.Dispose()
Some may wonder why I didn't use Send-MailMessage cmdlet, but in this case the inline image didn't play well with it, so I ended up using .Net.
And for bonus points if anyone knows how to send a copy to your Sent folder in your Outlook mailbox that would be great.