Hi,
DL-SGA-A78Admins:
We have a C# .NET WebSite which allow me to retrieve eml file from a SQL server database. I am using your Email Component to format this file and open attachement.Can you please save the EML file to the disc after retrieving from the SQL server database and see if its attachments are proper? Please provide us such an EML file after retrieving from the SQL database for our analysis. If possible, provide us with the original EML file as well (prior to storing in SQL database) so that we can analyze the original attachment.DL-SGA-A78Admins:
I can do it without problem with pdf but when it's an excel file, if I do not define the extension of the file by XLSX, it retrieve it as ZIP fileI would suggest to test the extracted Excel attachment by saving it to the disc and see if it is saved properly or not? This will enable us to identify if the component is doing some problem with the XLSX files or it is saved properly.DL-SGA-A78Admins:
My code is like that:Response.ContentType = "application/octet-stream"; //Without specify the extensionResponse.BinaryWrite(ToByteArray(sAtt));Can you please try:Response.ContentType = "application/vnd.ms-excel";Response.BinaryWrite(stream.ToArray());and see if it solves your problem. Please provide us your sample code (you can ignore the retrieving from SQL server part) in case the problem still persists. We will try to assist you further as soon as possible.
Hi Guillaume,
it’s the version 2.2.0. I will try by upgraded it to the new version if you validate it.
DL-SGA-A78Admins:
it's the version 2.2.0. I will try by upgraded it to the new version if you validate it.Even the Aspose.Email for .NET 2.2.0 doesn't show any attachments in your reference EML file. Anyways, I have reported the issue of attachments not detected by latest version of Aspose.Email for .NET 2.4.0 as NETWORKNET-33543 in our issue tracking system.As the attachments can't be detected at my end, I was unable to test the issue of "Extraction of attachment XLSX file as Zip". However, I have mentioned this issue as well to our development team for consideration. I will update you here once there is any information in this regard.PS: Is it possible for you to provide us with another EML file with XLSX attachments that can be processed using the 2.4.0, we will look into it and assist you further as soon as possible. You can use the 2.4.0 version with the following code to check if it detects the attachments properly.MailMessage msg = MailMessage.Load("filename.eml", MessageFormat.Eml);Console.WriteLine("Attachments Count: {0}", msg.Attachments.Count);
Hi,
Hi Guillaume,
I further investigated this issue and found that your sample file fileName.EML is corrupt. If you open this file in notepad, you will see that the first 8 Bytes are wrong. I removed these manually and used the following code to extract the XLSX file, which extracted properly. In addition, I would request you to please have a look at this LINK for your reference, which shows that it’s not an issue at Aspose.Email end. Please try the following code at your end and let us know your feedback
try
{
{
FileStream file = new FileStream(path, FileMode.Open);
byte[] bytes = new byte[file.Length];
file.Read(bytes, 0, (int)file.Length);
MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, (int)file.Length);
file.Close();
//Get the XLSX attachment from the EML file
MailMessage msg = MailMessage.Load(ms, MessageFormat.Eml);
ms.Close();
//Get the XLSX attachment from the EML file
Attachment att = msg.Attachments[0];
//Save the attachment to Stream
MemoryStream ms2 = new MemoryStream();
byte[] buffer;
att.Save(ms2);
ms2.Position = 0;
buffer = ms2.ToArray(); //save in byte[] array
//write to Response
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", String.Format("attachment;filename={0}", att.Name));
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.BinaryWrite(buffer);
Response.End();
}
}
catch (Exception ex)
{
if (!(ex is System.Threading.ThreadAbortException))
{
//Other error handling code here
}
}
The issues you have found earlier (filed as NETWORKNET-33543) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
Hi,
We have already facing some issue related to download email using EAGetEmail third party .dll.
Point 1- We have retrieve email and parse but some cases excel attachment or doc attachment show .eml format.
How can resolve this problem.
Regards,
Dinesh kumar sharma
Can you please share the complete details of the issue/requirement that you are facing along with source code used and test file. Please also share that which version of Aspose.Email for .NET you are using on your end.