When i try to send email through powershell im facing following issues 1.Im not able to change the sender as group mailbox 2.it does not read the attachments i add but the mail gets sent.
code im using :
$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "[email protected]"
$Mail.Subject = "sql"
$mail.attachments = 'C:\Users\desktop.ini'
$Mail.Body = ""
$Mail.Send()
error i'm receiving :
Property is read-only.
At C:\Users\Documents\sending email.ps1:5 char:1
+ $mail.attachments = 'C:\Users\desktop.ini'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
But the file is in my local