Below is the code for saving the pdf attachment but I am not able to open the pdf??? please answer my question as soon as possible
string strTemp = "D:\RahulTemp\";
ImapMessageCollection lst = imap.Search(ImapSearchParameter.Not(ImapSearchParameter.Deleted));
foreach (var val in lst)
{
MailMessage mm = new MailMessage();
mm = imap.GetMailMessage(val.UniqueId);
MailMessage mm2 = new MailMessage();
AttachmentCollection attcol = mm.Attachments;
for (int i = 0; i < attcol.Count; i++)
{
//if (attcol[i].FileName.Trim().EndsWith(".pdf") || attcol[i].FileName.Trim().EndsWith(".htm") || attcol[i].FileName.Trim().EndsWith(".html") || attcol[i].FileName.Trim().EndsWith(".doc") || attcol[i].FileName.Trim().EndsWith(".xls") || attcol[i].FileName.Trim().EndsWith(".xlsx") || attcol[i].FileName.Trim().EndsWith(".bmp"))
//{
//MimeEntity me = attcol[i].ToMimeEntity();
//me.Save(strTemp + me.ContentDisposition.FileName);
if (attcol[i].FileName.Contains(":"))
{
mm.Save(strTemp + attcol[i].FileName.Replace(":", "_")); //attcol[i].FileName
mm2.Attachments.Add(new Attachment(strTemp + attcol[i].FileName.Replace(":", "_")));
}
else
{
mm.Save(strTemp + attcol[i].FileName); //attcol[i].FileName
mm2.Attachments.Add(new Attachment(strTemp + attcol[i].FileName));
}
string str = mm.BodyText;
//}
}
imap.CopyMessage(val.UniqueId, "Archive");