Looking to send an e-mail using 365. I need to add an attachment. RRS feed

  • Question

  • Here is what I has so far and I am very close. I have tried many things. I added

    $attachment = New-Object System.Net.Mail.Attachment("XXXXX")
    But didn't work. The script below works for me I just need to add an attachment.

    $EmailFrom = "XXXX.com"
    $EmailTo = "XXXXX.com" 
    $Subject = "Testing" 
    $Body = "Thisisatest" 
    $SMTPServer = "XX.XXX.XXX.XXX" 
    $SMTPClient = New-Object Net.Mail.SmtpClient("Thisissmtp") 
    $SMTPClient.EnableSsl = $true 
    $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

    Monday, January 27, 2014 3:41 PM


All replies