I need to Download all attachments in my email to a local folder
Can any one help me to do the following,
I wants to download all my attached files in the email (inbox) automatically to my local folder
I tried with the following code to save the attachments to the local folder, but it throws an exception called imap component not licensed, invalid license key. like that
the code i used is
MailMessageCollection msgs = Imap.QuickDownloadMessages("pop.gmail.com", "tssrajkumar@gmail.com", "sanmugamsiva");
if (msgs.Count > 0)
{
foreach (MailMessage msg in msgs)
{
if (msg.Attachments.Count > 0)
{
Console.WriteLine("Attachment size list for message " + msg.UidOnServer.ToString());
foreach (Attachment attach in msg.Attachments)
{
Console.WriteLine(attach.Size.ToString());
}
}
else
{
Console.WriteLine("Message " + msg.UidOnServer.ToString() +" has no attachments");
}
Console.WriteLine();
}
}
Answers (1)
0
You have mixed up event handlers. DataReceived event is handled by
SerialDataReceivedEventHandler, while Timer's Tick event is handled by regular
EventHandler. You can't supply comPort1_DataReceived as argument to EventHandler constructor, because comPort1_DataReceived doesn't comply expected signature.