powershell send email with binary attachment
===

How do I send an email containing a binary file using powershell script? Below is my failing best attempt


    $to = 'andy.boo@boo.com'
    $subject = 'boo'
    $file = 'inf.doc'
    $from = $to
    $filenameAndPath = (Resolve-Path .\$file).ToString()
    
    [void][Reflection.Assembly]::LoadWithPartialName('System.Net') | out-null
    
    $message = New-Object System.Net.Mail.MailMessage($from, $to, $subject, $subject)
    $attachment = New-Object System.Net.Mail.Attachment($filenameAndPath, 'text/plain')
    $message.Attachments.Add($attachment)
    
    $smtpClient = New-Object System.Net.Mail.SmtpClient
    $smtpClient.host = 'smtp.boo.com'
    $smtpClient.Send($message)


