When i am reading attachments it is displaying wrong count of attachments..if the email has only one attachment, i will get the output as 3. please someone help me to solve this,,
This is the code i use to get attachments..
// Getting the Attachments and insert into the database
This is the code i use to get attachments..
// Getting the Attachments and insert into the database
List<ImapX.Attachment> attachmentList = message.Attachments;
if (attachmentList.Count > 0)
{
foreach (var attachment in attachmentList)
{
Model.Attachments myAttachment = new Model.Attachments();
myAttachment.MessageId = myMails;
myAttachment.AttachmentName = attachment.FileName;
myAttachment.AttachmentEncodings = attachment.FileEncoding;
myAttachment.BinaryData = attachment.FileData;
myAttachment.FileType = attachment.FileType;
myAttachment.FileSize = attachment.FileSize;
myAttachment.MailSubject = myMails.MailSubject;
myAttachment.MailUser = myMails;
myAttachment.FolderName = myMails;
// Insert Mails Into Mails table code gores here
bool resultAttachment = mailsToDb.insertIntoAttachmentTable(myAttachment);
if (resultAttachment)
{
}
}