Free Support Forum - aspose.com

Embedded Object

I try to use example of 2.2.0.0 to parse eml with (Aspose MIME). It is impossible to get Embedded object from eml. Whereas I can get Attachements from my Email. What is the problem I have Evaluation version.

hello,

Thanks for considering Aspose.Network. Please upload your .eml here or send to guangzhou@aspose.com to help us locate that issue.

thanks.

[:@Big Smile [:D]

Have you got any information about my post. I send you example of email with embedded picture

hello,




Thank you for considering Aspose.Network!


I’ve receive your mail, we’ve already started testing, plz wait for our result.




Thanks.

Hello,

We've released Aspose.Network 2.2.1.0.

In this release, we have explored some issues and fixed some bugs:

Fixed attachment truncation in Mail components
Fixed parsing embeded objects of eml files in Mime components
Improved Disconnect fuction of Aspose.Network.Ftp.FtpClient class. Multiple invoking Disconnect/Connect function of a FtpClient will now follow a more fault tolerant approach
Improved Dispose function of Aspose.Network.Ftp.FtpClient class.

I hope this will solve that problem, Please try it.
http://www.aspose.com/Downloads/Aspose.Network/2.2.1.0/Default.aspx

Thank you very much.

Smile [:)]

OK thank you this new release work very good except method : attachment.GetFileName() for Embedded Object.

My application parse EML message and create new message with embedded object and attech file.

My application works with HEAvy Client OutLook express and OutLOOK 2003. But It doesn't work with OWA (OUTLOOK WEB ACCESS) webclient.With OWA It is impossible to get Embedded Object in Mail.

public MailMessage CreateMessage()
{
//RECUPERATION DU MIMEMESSAGE
MimeMessage mimemessage=null;

//REPERTOIRE D'UPLOAD
if (!Directory.Exists(this.UploadDir))
{
Directory.CreateDirectory(this.UploadDir);
}
//SOUS REPERTOIRE D'UPLOAD
if (!Directory.Exists(this.UploadDir + ConfigurationSettings.AppSettings["UPLOADDIRFILEMAIL"]))
{
Directory.CreateDirectory(this.UploadDir + ConfigurationSettings.AppSettings["UPLOADDIRFILEMAIL"]);
}

using(StreamReader r = new StreamReader(this.UploadDir + ConfigurationSettings.AppSettings["UPLOADDIRFILEMAIL"]+ "\\" + this.Emlfile) )
{
mimemessage = new MimeMessage(r);
}

//CREATION DU Mail Message
MailMessage msg = new MailMessage();
msg.From = new MailAddress(mimemessage.From.Address);
msg.Date = mimemessage.Date;
msg.ReplyTo = mimemessage.ReplyTo;

// TEXT HTML
TextHtmlBody htmlBody = new TextHtmlBody();
htmlBody.Content = mimemessage.HtmlContent;
htmlBody.Charset = "Windows-1252";
// TEXT PLAIN
TextPlainBody plainBody = new TextPlainBody();
plainBody.Content = mimemessage.PlainContent;
plainBody.Charset = "Windows-1252";

AlternativeBody altBody = new AlternativeBody();

altBody.AddPart(htmlBody);
altBody.AddPart(plainBody);
msg.Body = altBody;

ArrayList attachefile = ParseMIME.getAttachFile(mimemessage,this.UploadDir);
ArrayList Embeddedfile = ParseMIME.getEmbeddedFile(mimemessage,this.UploadDir);

if (attachefile != null)
{
foreach(string filenametemp in attachefile)
{
msg.AddAttachment(new Attachment(filenametemp));
}
}

if (Embeddedfile != null)
{
foreach(PictureEmbedded pictureEmbedded in Embeddedfile)
{
Attachment embeddedImage = new Attachment(pictureEmbedded.FileName);
embeddedImage.ContentId = pictureEmbedded.Cid.Substring(1,pictureEmbedded.Cid.Length-2);
msg.AddEmbeddedObject(embeddedImage);
}
}
return msg;
}

hi, could you please try to use the GetName function of the MimeMessage class?



thanks

Big Smile [:D] ok for getname of mime message function.

But my first issue is that the function AddEmbeddedObject doesn't work with OWA (OUTLOOK WEB ACCESS).

In my company we need to see mail with heavy client outlook express, outlook 2003, but with OWA Light web client. I think there are a problem with method AddEmbeddedObject and OWA web Client. I don't see the embedded object with OWA

Hi, Saulinfr,



Could you send me your eml file for the investigating? It seems you
want to recreate the email from some eml file and resend it. If we get
the eml file, the problem could be easy to reproduce and trace. Please
send me the eml file and the relative attachement and embeded files
which in the “uploaddir” .



What’s more I found your code including some other functions invoking like :

ArrayList attachefile =
ParseMIME.getAttachFile(mimemessage,this.UploadDir);

ArrayList
Embeddedfile = ParseMIME.getEmbeddedFile(mimemessage,this.UploadDir);



Could you also send me the implementations of these functions?



Thanks very much, and sorry for any inconvience.

I send you my code plus eml file :

public static ArrayList getAttachFile(MimeMessage msg,string path)
{
System.Collections.ArrayList fileNameA=null;
string fileName =string.Empty;
if (!Directory.Exists(path + ConfigurationSettings.AppSettings["ATTACHFILE"]))
{
Directory.CreateDirectory(path + ConfigurationSettings.AppSettings["ATTACHFILE"]);
}

MimePart [] attachments = msg.GetAttachments();
foreach (MimePart attachment in attachments)
{
fileName = attachment.GetFileName();
string fileName2 = fileName;
if (fileName == null || fileName == string.Empty)
{
string extension = attachment.GetDefaultExtension();
fileName = new CustomTempFileNameProvider(path + ConfigurationSettings.AppSettings["ATTACHFILE"] , extension).GetTempFileName();
}
else
{
fileName = path + ConfigurationSettings.AppSettings["ATTACHFILE"] + "\\" + fileName;
if (fileNameA == null)
fileNameA = new System.Collections.ArrayList();
fileNameA.Add(fileName);
}

attachment.SaveDecodedContent(fileName) ;
}
return fileNameA;
}


public static System.Collections.ArrayList getEmbeddedFile(MimeMessage msg,string path)
{
if (!Directory.Exists(path + ConfigurationSettings.AppSettings["EXTRACTIMG"]))
{
Directory.CreateDirectory(path + ConfigurationSettings.AppSettings["EXTRACTIMG"]);
}

ArrayList fileNameA=null;
string fileName =string.Empty;
PictureEmbedded _PictureEmbedded =null;

MimePart [] attachments = msg.GetEmbedded();

foreach (MimePart attachment in attachments)
{
if (fileNameA == null)
fileNameA = new ArrayList();

fileName = attachment.GetName();
string fileName2 = fileName;
if (fileName == null || fileName == string.Empty)
{
string extension = attachment.GetDefaultExtension();
fileName = new CustomTempFileNameProvider(path + ConfigurationSettings.AppSettings["EXTRACTIMG"], extension).GetTempFileName();
_PictureEmbedded = new PictureEmbedded();
_PictureEmbedded.Cid = attachment.ContentId;
_PictureEmbedded.FileName = fileName;
fileNameA.Add(_PictureEmbedded);
}
else
{
fileName = path + ConfigurationSettings.AppSettings["EXTRACTIMG"]+ "\\" + fileName;
_PictureEmbedded = new PictureEmbedded();
_PictureEmbedded.Cid = attachment.ContentId;
_PictureEmbedded.FileName = fileName;
fileNameA.Add(_PictureEmbedded);
}
;
attachment.SaveDecodedContent(fileName) ;
}
return fileNameA;
}

Dear saulinfr,



We have made some fixes in the Aspose.Network according to your case.
The attachment is an internal release for the validating. Could you
please give it another go?



Thanks very much, and feel free to ping me with any problems.