Hi,
Have you tried the above coding. for me still problem..
At the same time , while attaching the items to mail, after receiving the mail. the attachment opened empty.
the below code : for attachment for the mail:
foreach
(AttachmentItem item in ctrlUploadAttachments.Items)
{
byte[] data = new byte[item.FileSize];
objUploadFileItemDTO.FileBytes = data;
string
[] ChkFileType;
ChkFileType = item.FileName.Split(
'.');
string FileType = ChkFileType.GetValue(1).ToString();
switch (FileType.ToUpper())
{
case "XLS": objUploadFileItemDTO.ContentType = "application/ms-excel"; break;
case "XLSX": objUploadFileItemDTO.ContentType = "application/ms-excel"; break;
case "DOC": objUploadFileItemDTO.ContentType = "application/msword"; break;
case "PDF": objUploadFileItemDTO.ContentType = "application/ms-excel"; break;
case "HTML": objUploadFileItemDTO.ContentType = "application/octet-stream"; break;
case "XML": objUploadFileItemDTO.ContentType = "application/octet-stream"; break;
case "XSN": objUploadFileItemDTO.ContentType = "application/msinfopath"; break;
default: objUploadFileItemDTO.ContentType = "application/octet-stream"; break;
}
objUploadFileItemDTO.FileName = item.FileName;
}
MemoryStream objMemoryStream = new MemoryStream((objUploadFileItemDTO.FileBytes);
Attachment objAttachment = new Attachment(objMemoryStream, objUploadFileItemDTO.ContentType);
objAttachment.ContentDisposition.DispositionType = System.Net.Mime.DispositionTypeNames.Attachment;
objAttachment.ContentDisposition.FileName = objUploadFileItemDTO.FileName;
objMailMessage.Attachments.Add(objAttachment);
thanks
Senthilkumar.T