Quantcast
Channel: Aspose.Email Product Family
Viewing all 1367 articles
Browse latest View live

Some characters cannot be rendered correctly in result of saving from msg in to html

$
0
0
Hi there

We are working on saving .msg file into HTML format.

And here is our code for test:

byte[] msgContent;
msgContent = IOUtils.toByteArray(new FileInputStream("mailTest.msg"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MailMessage msg = MailMessage.load(new ByteArrayInputStream(msgContent));
HtmlSaveOptions saveOps = new HtmlSaveOptions();
saveOps.setCheckBodyContentEncoding(true);
saveOps.setEmbedResources(true);
saveOps.setMailMessageSaveType(MailMessageSaveType.getHtmlFormat());

msg.save(baos, saveOps);
IoUtil.write(new FileOutputStream("result.html"), baos.toByteArray());

Please also check the input file and output file in the attachment.
Some characters in the result are not rendered correctly.

Is there some option to fix this?


Craig

Sending HTML as mail body with embedded fonts etc.

$
0
0
Hi,
I have a PDF document which I have converted to HTML using Aspose.PDF.
I have embedded everything into the html (see code below).

When using the "HtmlLoadOptions" of Aspose.Email and sending the email - the output in Microsoft Outlook (and the web-interface), looks strange. However, if I use the "view in webbrowser" in Outlook, the result is better (see attached pictures)

I have used the following code:

            Dim pdfDoc As New Aspose.Pdf.Document(pdfStream)

            Dim newOptions = New Aspose.Pdf.HtmlSaveOptions()
            newOptions.RasterImagesSavingMode = Aspose.Pdf.HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground
            newOptions.FontSavingMode = Aspose.Pdf.HtmlSaveOptions.FontSavingModes.SaveInAllFormats
            newOptions.PartsEmbeddingMode = Aspose.Pdf.HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml
            newOptions.LettersPositioningMethod = Aspose.Pdf.HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss
            newOptions.SplitIntoPages = False
            newOptions.CustomHtmlSavingStrategy = New Aspose.Pdf.HtmlSaveOptions.HtmlPageMarkupSavingStrategy(AddressOf SavingToStream)
            pdfDoc.Save("C:\Test\DoesNotMatter.html", newOptions)


--

        Private Shared Sub SavingToStream(ByVal htmlSavingInfo As Aspose.Pdf.HtmlSaveOptions.HtmlPageMarkupSavingInfo)
            Dim loadOptions As New Aspose.Email.Mail.HtmlLoadOptions()

            Dim message = Aspose.Email.Mail.MailMessage.Load(htmlSavingInfo.ContentStream, loadOptions)
            message.From = "Something"
            message.To = "Something"
            message.Subject = "Something"

            ' Send the message using Aspose.Email
            Dim client As New Aspose.Email.Mail.SmtpClient()
            client.Host = "Something"
            client.Port = 25
            client.Send(message)
        End Sub

--

Earlier I have used the "Save as MHTML" (in Aspose.Words), but this option is not available in Aspose.PDF

Am i doing something wrong, or how am I able to insert my PDF document as the "mail body"?
Since the "Save as MHTML" is not available, I have tried to save the pdf as HTML, but its not working 100% just yet

Hope you can help :)

Email viewer

$
0
0
Hi,

Is there any plan to support email viewing functionality in near future?

Changing default PST name

$
0
0
Hi,

When we create a PST and open in MS Outlook, it represents PST as "Personal Folder". Can this be changed to customized PST name?

Getting exception while extracting messages from PST in parallel

$
0
0
We are getting exception when trying to extract messages from PST in parallel threads. We doubt that the API doesn't support extract messages in parallel although we are using locks. Can anyone confirm if it is like this?


Strange carachters in french mails

$
0
0
Hi

I'm facing a problem when i'm creating my msg and my html from an eml. (see attachments)

The problem is that i'f you open the EML, you will see that the charset is 
charset="Windows-1252"

The moment that I generate my MSG. My charset is still 
{\*\htmltag241 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">}

And the moment that i generate the HTML still the charset is Windows-1252.

I think for the msg that's no problem because I can see the french characters.
But for the html you will see that the french carachters are strange.
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">

Bellow you can see my code:


        public static void ConvertEmlToMsg(string emlFilePath, out string msgFilePath)
        {
            var mailMessage = MailMessage.Load(emlFilePath, new EmlLoadOptions());
            msgFilePath = FileUtility.GetTempFileName("msg");
            mailMessage.PreferredTextEncoding = Encoding.UTF8;
            mailMessage.Save(msgFilePath, Aspose.Email.Mail.SaveOptions.DefaultMsgUnicode);
        }

 public static string GetMailFile(string msgFilepath, out List<MailAttachment> attachments)
        {
            attachments = new List<MailAttachment>();
            string result;

            var tmpFileName = FileUtility.GetTempFileName("tmp");
            // Try saving as HTML
            try
            {
                var mailMessage = MailMessage.Load(msgFilepath, new MsgLoadOptions());
                mailMessage.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
                mailMessage.BodyEncoding = Encoding.UTF8;
                mailMessage.PreferredTextEncoding = Encoding.UTF8;

                HtmlSaveOptions options = Aspose.Email.Mail.SaveOptions.DefaultHtml;
                mailMessage.IsBodyHtml = true;

                //save the message headers to output HTML using the formatting options
                options.HtmlFormatOptions = HtmlFormatOptions.WriteHeader | HtmlFormatOptions.WriteCompleteEmailAddress;
                options.MailMessageSaveType = MailMessageSaveType.HtmlFormat;
                options.CheckBodyContentEncoding = true;
                SetFormatHeaderDate(mailMessage);

                //First save the mail as a HTML
                mailMessage.Save(tmpFileName, options);
 }
            catch
            {
                if (File.Exists(tmpFileName))
                {
                    try { File.Delete(tmpFileName); }
                    catch { }
                }
                tmpFileName = null;
            }
}


Is There a way to read and convert from a MBOX file to other file format like MSG?

$
0
0
Hello,

Is There a way to read and convert from a MBOX file to other file format like MSG?

regards!

MBOX to HTML conversion

$
0
0
Hello,

Is There a way to read and convert from a MBOX file to HTML file using Aspose.email?

Thank & regards!
Mantu Malakar

Wrong DeliveryTime in Mail sent by Macro

$
0
0
Hello,

I have a problem regarding MapiMessages. We try to read DeliveryTime from a MapiMessage, which was sent through a Macro in Excel. 

When I view the mail in MFCMAPI, the PR_MESSAGE_DELIVERY_TIME is correct, but your Framework says, that it's "Sat Jan 01 00:00:00 CET 1" - why?

You find an example as attachment to this post.

Thanks in advance

Andi

How to add nested message to EML message in TNEF format (winmail.dat)

$
0
0
Hi,

Tested Aspose.Email 6.9 and here are my findings. 

  • I cannot embed EML files into TNEF message, if PreserveTnefAttachments is used. Resulting message will have regular EML attachment, not embedded/nested message.

var m = MailMessage.Load(@"sample.eml");
m.Attachments.Add(
    new Attachment(File.OpenRead("EML file.eml"),
    "EML as message-rfc822.eml",
    "message/rfc822")); // will be added as regular attachment if PreserveTnefAttachments is used
.

m.Save(@"resaved.eml", new EmlSaveOptions(MailMessageSaveType.EmlFormat) { FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments });

  • I noticed that if I add MSG file to TNEF message, do not specify content type and use PreserveTnefAttachments, then Aspose.Email embeds MSG. So you changed default behavior (previously file was attached), that is not good. Moreover, if PreserveTnefAttachments is not used, MSG will be attached (not embedded) - and this is inconstant behavior. The best way is to attach (not embed) MSG if content type is not specified either PreserveTnefAttachments is used or not.

  • I added MSG to TNEF message, specified "message/rfc822" and used PreserveTnefAttachments - message was attached. But when I specified "application/octet-stream" - message was embedded.This is wrong behavior and it is opposite to what happens if PreserveTnefAttachments is not specified.

var m = MailMessage.Load(@"sample.eml");
m.Attachments.Add(
    new Attachment(File.OpenRead("MSG file.msg"), 
    "MSG as message-rfc822.eml", 
    "message/rfc822")); // will be added as regular attachment if PreserveTnefAttachments is used
.

m.Attachments.Add(
    new Attachment(File.OpenRead("MSG file.msg"), 
    "MSG as application-octet-stream.eml", 
    "application/octet-stream")); // will be added as embedded message if PreserveTnefAttachments is used
.

m.Save(@"resaved.eml", new EmlSaveOptions(MailMessageSaveType.EmlFormat) { FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments });

Thanks,
Alex

EMLX File not able to properly load body

$
0
0
Hello Team,

I've been using Aspose.Email for creating pst and using latest version of it 16.12.0.0

I can share you the emlx file after loading the content its showing extra xml content which is in appropriate.

If i open the same emlx file in MAC (Apple Operating System) as emlx format belongs to MAC OS it shows properly without any extra xml content, i've attached screenshot of preview of MAC machine and emlx file in the attachment.

Is it possible to get this solved on HIGH Priority as we are already behind schedule.

Really appreciate your work.

Thank You.

Regards,
Amit

Object reference not set to an instance of an object

$
0
0
Hi there. I am getting messages from exchange public folders and save them into local file system. My code works fine for some PFs, but for some of them I get "Object reference not set to an instance of an object" when execute client.ListMessages(publicFolder.Uri) or client.ListMessagesFromPublicFolder(publicFolder). See the code snippet below: Console.WriteLine("Folder Name: " + publicFolder.DisplayName); //ExchangeMessageInfoCollection msgInfoCollection = client.ListMessagesFromPublicFolder(publicFolder); ExchangeMessageInfoCollection msgInfoCollection = client.ListMessages(publicFolder.Uri); foreach (ExchangeMessageInfo messageInfo in msgInfoCollection) { MailMessage msg = client.FetchMessage(messageInfo.UniqueUri); Console.WriteLine(msg.Subject); string guid = Guid.NewGuid().ToString("N"); msg.Save(string.Concat("guid", ".msg"), SaveOptions.DefaultMsgUnicode); All the input parameters for the call are set. Thanks --arthur }

EML file's attachment extension is getting changes &amp; format is getting change Aspose

$
0
0
Hello Team,

I've been using Aspose.Email latest version 16.12.0.0 and got an issue that if an eml file contains attachment such as .eml it change it to msg(not just extension but also its format).

I've attached the eml sample too, please use the following code :

class Program
    {
        static void Main(string[] args)
        {
            MailMessage f_Objmailmessage = null;
            MapiMessage f_mapimessage = null;

            try
            {
                string f_tmpEmlPath = "C:\\Different fields.eml";
                f_Objmailmessage = MailMessage.Load(f_tmpEmlPath, new EmlLoadOptions());

                f_mapimessage = MapiMessage.FromMailMessage(f_Objmailmessage, MapiConversionOptions.UnicodeFormat);

            }
            catch (Exception ex)
            {
                            
            }
        }
    }

After loading into mapi message it show that the attachment of eml has change to msg, that is very inappropriate.

Can you please take this issue into account and resolve this on high priority as we are already behind our schedule and i'm facing too many issue with Aspose.

Hoping this to be get done by today.

Thank You.

Regards,
Amit 

corrupt msg file after converting from eml

$
0
0
Hello,

the following two sourcecode-lines create a corrupt msg file if in the eml-file is a Appointment:
The result msg-file can't open with Outlook 2010 (14.0...)
Message ist "Cannot read the item"

// ..
emlMessage = MailMessage.Load("filename.eml", new EmlLoadOptions());
emlMessage.Save("filename.msg",Aspose.Email.Mail.SaveOptions.DefaultMsgUnicode);
../

16.11.0.0 .net c#

If you need the eml-file please let me know.

Greetings,
Georg

IPM.Appointment not saving OCCURANCE & ORGANIZER info to PDF

$
0
0
When I save an outlook calendar item to PDF, the occurrence and organizer fields are not displayed.  I cannot figure out how to save the PDF so that those fields are displayed.  If I do a print from outlook, the information is in the displayed image being sent to print.

Can I save appointment items to PDF and have those fields displayed?
If so, how?

Thank you! 

Aspose Email Contact Unit test

$
0
0

Hi,

Pls find attached our AsposeContactTest class we built so as to test all individual attributes which are NOT populated correctly according to our tests.

Principle is simple and applied for each attribute:

1.      we create a MapiContact,

2.      insert 1 attribute,

3.      save MapiContact on Exchange test,

4.      retrieve contact using ListContacts procedure,

5.      compare attribute between MapiContact created and MapiContact retrieved

 Pls tell us if anything wrong in our tests.

We would appreciate a complete answer on all attributes concerned.

Another problem is incoherence between Contact and MapiContact (could you please fix one of them and let us know which one we should use for all task) 


Rg.

Some characters cannot be rendered correctly in result of saving from msg in to html

$
0
0
Hi there

We are working on saving .msg file into HTML format.

And here is our code for test:

byte[] msgContent;
msgContent = IOUtils.toByteArray(new FileInputStream("mailTest.msg"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MailMessage msg = MailMessage.load(new ByteArrayInputStream(msgContent));
HtmlSaveOptions saveOps = new HtmlSaveOptions();
saveOps.setCheckBodyContentEncoding(true);
saveOps.setEmbedResources(true);
saveOps.setMailMessageSaveType(MailMessageSaveType.getHtmlFormat());

msg.save(baos, saveOps);
IoUtil.write(new FileOutputStream("result.html"), baos.toByteArray());

Please also check the input file and output file in the attachment.
Some characters in the result are not rendered correctly.

Is there some option to fix this?


Craig

Aspose.Email 6.9--CreateContact issue

$
0
0
Hello.

we are having problem with create contact with Exchange server.

the problem is following
we create client = EWSClient.GetEWSClient
with application credentials which has access to users email.

but when we do client.CreateContac(outlookContact), it create contact not for the specific email but for the appictaion username.

is there way to specify the email account you the contact to be created for.

other work around I found is this
client.MoveItem(itemUri, contactsUrl);
but it throws an error message "Item move failed".

Please advise

Adding embedded MSG to a MapiMessage

$
0
0
Is there a way to create an embedded attachment to a MapiMessage?

When I attach an email to another in Outlook I can see that the MapiProperty PR_ATTACH_METHOD = 5 and that PR_ATTACH_DATA_OBJ = Object.

Is there a way to create a new MapiMessage and add an attachment such that it will have the same PR_ATTACH_METHOD tag?

Thanks,
//C

Email to Html Conversion

$
0
0
Hi ,

I have need proper code to convert email body to html file. I have also look some old post for refer but in that post convert from file have extension ".eml" but before that their is no information.

So, please help me out their and provide proper code for conversion.


Thanks,

Rakesh Kumar



Viewing all 1367 articles
Browse latest View live