Miasy
  • Miasy
  • 51.5% (Neutral)
  • Newbie Topic Starter
5 years ago
Hey Guys,

When using the following code:

$mail.AddAttachment = "C:\LocalPathTo\my.log"

I seem to be getting the following error returned in the console:

Failed to send email: Cannot set the Value property for PSMemberInfo object of type "System.Management.Automation.PSMethod".

In addition I have also noticed this issue when attaching .jpg/.png files but I did get it to work in my initial tests with a PDF.

I doubt it has anything to do with size as the files that I am trying to attach are just .log files with a size of aprox' 100kb

I can't seem to find any mention of this error in regards to EASendMail online so a bit of help on what to look out for would be much appreciated.

p.s. If you haven't guessed by the $ I am working with PowerShell don't know if that makes a difference but thought I'd mention it in case the protocols are different etc.

Thanks,
Maisy
ivan
  • ivan
  • 100% (Exalted)
  • Administration
5 years ago
AddAttachment is method, not a property, the correct syntax is:

$mail.AddAttachment("C:\LocalPathTo\my.log")
Miasy
  • Miasy
  • 51.5% (Neutral)
  • Newbie Topic Starter
5 years ago
Ah sweet thanks, can't believe I overlooked that one! It's working now thanks!

Regards,
Maisy

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.