I'm looking for assistance on this matter. Any help would be excellent.
I'm using C# (Visual Studio) and I'm trying to send emails through Outlook through late binding.
This is my code.
Code:...
This is an overloaded method. I'm just posting the overload that uses attachments because that's where my problem is. The code works fine for the non-attachment overload, but if I try to use an attachment, it errors out on the line
Code:objMailAttachments.GetType().InvokeMember("Add", BindingFlags.InvokeMethod, null, objMailAttachments, new object[] { Attachment, Type.Missing, Type.Missing, Type.Missing });
"Exception has been thrown by the target of an invocation."
I check the inner exception, and I get "You don't have appropriate permission to perform this operation."
Which leads me to believe that security changes have been made to our email server, since it's been working fine until now. Unfortunately I can't do anything about that.
So my question is, is there something I can change in my existing code which will allow attachments to be sent? If not, is there an alternate method I can use to send emails with attachments, using late binding, without any dialogs, or the user having to provide credentials, and with the ability to display the email before sending it?
Does your solution absolutely have to use Outlook? A simple work around would be to just use the SmtpClient.