I'm trying to successfully run the C# code below but it keeps failing when I run the package, even though the code compiles successfully.
#region Namespaces
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using Limilabs.Client.IMAP;
using Limilabs.Client.POP3;
using Limilabs.Client.SMTP;
using Limilabs.Mail;
using Limilabs.Mail.MIME;
using Limilabs.Mail.Fluent;
using Limilabs.Mail.Headers;
using System.Collections.Generic;
#endregion
//.......name and class stuff....///
using(Pop3 pop3 = new Pop3())
{
pop3.ConnectSSL("outlook.office365.com");
pop3.UseBestLogin("USER", "PASSWORD");
foreach (string uid in pop3.GetAll())
{
IMail email = new MailBuilder()
.CreateFromEml(pop3.GetMessageByUID(uid));
Console.WriteLine(email.Subject);
// save all attachments to disk
foreach (MimeData mime in email.Attachments)
{
mime.Save(mime.SafeFileName);
}
}
pop3.Close();
}
//....now end the class and complete...///
Below is the error I am seeing.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Has anyone seen this and fixed it before? the error message is very vague.