Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Miasy  
#1 Posted : Wednesday, February 19, 2020 2:02:55 AM(UTC)
Miasy

Rank: Newbie

Groups: Registered
Joined: 2/19/2020(UTC)
Posts: 0
United Kingdom
Location: Leeds

Hey Guys,

When using the following code:

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


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

Code:
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  
#2 Posted : Wednesday, February 19, 2020 3:13:04 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,153

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
AddAttachment is method, not a property, the correct syntax is:
Code:

$mail.AddAttachment("C:\LocalPathTo\my.log")
Miasy  
#3 Posted : Wednesday, February 19, 2020 4:02:08 AM(UTC)
Miasy

Rank: Newbie

Groups: Registered
Joined: 2/19/2020(UTC)
Posts: 0
United Kingdom
Location: Leeds

Ah sweet thanks, can't believe I overlooked that one! It's working now thanks!

Regards,
Maisy
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.059 seconds.

EXPLORE TUTORIALS

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