Saving MSG file loses properties from the Email Message

Last post 06-09-2010, 9:23 AM by saqib.razzaq. 15 replies.
Page 1 of 2 (16 items)   1 2 Next >
Sort Posts: Previous Next
  •  08-03-2009, 4:19 AM 191662

    Saving MSG file loses properties from the Email Message .NET

    I am attempting to generate a MSG file from scratch, to generate a template email for the user, using the Aspose.Network library (version 4.7.0.3), and it is partially working - a MSG file is generated, and will open within Outlook, however a number of properties are modified when Outlook reads the generated MSG file back.

    1. The Priority of the Message is lost completely
    2. The Attachments are modified to be mapped as Inline within the opened attachment.
    I have also tried using the NormalMessageMailMessageInterpretor class, but calling save using this class generates a MailException with the following message

    "Recent Aspose.Network does not support saving to Msg format file."

    The code being used for the generation of the email is as follows:

                Aspose.Network.License newLicence = new Aspose.Network.License();
                newLicence.SetLicense(@"<valid license here>");

                // Create a Mail Message
                Aspose.Network.Mail.MailMessage newMessage = new Aspose.Network.Mail.MailMessage();
                newMessage.To.Add("to@sample.com");
                newMessage.TextBody = "Sample Text";
                newMessage.Subject = "Sample Subject";

                // Set the priority
                newMessage.Priority = Aspose.Network.Mail.MailPriority.High;

                // Add an Attachment
                Aspose.Network.Mail.Attachment attachmentToAdd = new Aspose.Network.Mail.Attachment(@".\testattachment.txt");

                attachmentToAdd.ContentDisposition.Inline = false;
                attachmentToAdd.ContentDisposition.DispositionType = System.Net.Mime.DispositionTypeNames.Attachment;

                newMessage.AddAttachment(attachmentToAdd);

                // Now save this message as a .MSG file
                Aspose.Network.Outlook.MapiMessage mapiMessage = Aspose.Network.Outlook.MapiMessage.FromMailMessage(newMessage);

                // Set the Unsent Flag
                mapiMessage.SetMessageFlags(Aspose.Network.Outlook.MapiMessageFlags.MSGFLAG_UNSENT);
                mapiMessage.SetStringPropertyValue(Aspose.Network.Outlook.MapiPropertyTag.PR_SENDER_EMAIL_ADDRESS, "");
                mapiMessage.SetStringPropertyValue(Aspose.Network.Outlook.MapiPropertyTag.PR_SENDER_NAME, "");

    // Generates a msg file without Priority or Attachment within the Inline
                mapiMessage.Save("outputmessage.msg");


    // Throws a Message Exception
                Aspose.Network.Outlook.NormalMessageMailMessageInterpretor messageInterpreter = new Aspose.Network.Outlook.NormalMessageMailMessageInterpretor();
                messageInterpreter.Save(mapiMessage, new FileStream(@".\outputmessage2.msg", FileMode.Create), Aspose.Network.Mail.MessageFormat.Msg);

    Filed under: .MSG;Outlook
     
  •  08-03-2009, 9:43 AM 191712 in reply to 191662

    Re: Saving MSG file loses properties from the Email Message

    Hi,

    1. Please use MailMessage.Save(filename, MessageFormat.Msg) to save a mailmessage instance to msg file. As code sample:

    Aspose.Network.License newLicence = new Aspose.Network.License();
                newLicence.SetLicense(@"<valid license here>");

                // Create a Mail Message
                Aspose.Network.Mail.MailMessage newMessage = new Aspose.Network.Mail.MailMessage();
                newMessage.To.Add("to@sample.com");
                newMessage.TextBody = "Sample Text";
                newMessage.Subject = "Sample Subject";

                // Set the priority
                newMessage.Priority = Aspose.Network.Mail.MailPriority.High;

                // Add an Attachment
                Aspose.Network.Mail.Attachment attachmentToAdd = new Aspose.Network.Mail.Attachment(@".\testattachment.txt");

                attachmentToAdd.ContentDisposition.Inline = false;
                attachmentToAdd.ContentDisposition.DispositionType = System.Net.Mime.DispositionTypeNames.Attachment;

                newMessage.AddAttachment(attachmentToAdd);

                newMessage.Save("message.msg", MessageFormat.Msg);//save to msg

    2. For the priority issue, we are now working on it. I will get back to you ASAP.

    Thanks,


    Team Lead
    Aspose Guangzhou Team
    About Us

    Contact Us
     
  •  08-03-2009, 10:03 AM 191716 in reply to 191712

    Re: Saving MSG file loses properties from the Email Message

    I have tried using the suggested method

    newMessage.Save("outputmessage3.msg", Aspose.Network.Mail.MessageFormat.Msg);

    However the MSG file generated now says "Internet Message - sender and content cannot be verified". In addition the Importance and attachment are still broken. This is the same as when I saved the file as .EML as an experiment.

    So this method seems worse than the method I was using before.

    Peter
     
  •  08-06-2009, 7:27 AM 192327 in reply to 191716

    Re: Saving MSG file loses properties from the Email Message

    From the silence can I take it that the control does not support the creation of a .MSG file from a MailMessage ?

    If so, do you have any suggestions of a way of generating a .MSG file without the properties becoming lost / modified ?

    Thanks.

    Peter
     
  •  08-06-2009, 8:38 AM 192338 in reply to 192327

    Re: Saving MSG file loses properties from the Email Message

    Hi Peter,

    Our developer is working this, including priority and attachment issues. Could you please provide your testing eml files for our test? I will get back to you ASAP.

    Thanks,


    Team Lead
    Aspose Guangzhou Team
    About Us

    Contact Us
     
  •  08-06-2009, 9:04 AM 192347 in reply to 192338

    Re: Saving MSG file loses properties from the Email Message

    Attachment: Present (inaccessible)
    Attached are the MSG files generated by the code above, in a Zip

    Outputmessage3.msg is generated by

    newMessage.Save("outputmessage3.msg", Aspose.Network.Mail.MessageFormat.Msg);

    Outputmessage.msg is generated by

    mapiMessage.Save("outputmessage.msg");

     
  •  08-06-2009, 9:16 AM 192351 in reply to 192347

    Re: Saving MSG file loses properties from the Email Message

    Hi Peter,

    Thanks for your help.

    I will get back to you ASAP.

     


    Team Lead
    Aspose Guangzhou Team
    About Us

    Contact Us
     
  •  08-17-2009, 3:13 AM 193471 in reply to 192351

    Re: Saving MSG file loses properties from the Email Message

    Any progress on a fix for this problem yet ?


     
  •  08-27-2009, 2:48 AM 195277 in reply to 193471

    Re: Saving MSG file loses properties from the Email Message

    From the silence I will take is as read that this won't be fixed.

    As this functionality was the entire reason we bought the control, this is somewhat disappointing.
     
  •  08-27-2009, 3:06 AM 195280 in reply to 195277

    Re: Saving MSG file loses properties from the Email Message

    Hi,

    We are still working on this issue. But it is not yet resolved. I will keep you updated when we fix it.


    Team Lead
    Aspose Guangzhou Team
    About Us

    Contact Us
     
  •  09-04-2009, 2:55 PM 196813 in reply to 195280

    Re: Saving MSG file loses properties from the Email Message .NET

    I am encountering the same problem when saving attachments of email that are themselves email.

    I started a thread about it (though as of this writing no one has responded)


    I'm interested if you find a solution.

    Thanks

    P.S.  By "same" I mean that after I get these attachments and determine they are email I am running this bit of code below.  I get the same "sender and content cannot be verified" message in the MSG.

                        Aspose.Network.Mail.MailMessage msgAtt = Aspose.Network.Mail.MailMessage.Load(emlPath, Aspose.Network.Mail.MessageFormat.Eml);
                        msgAtt.Save(emlPath.Replace(".eml", ".msg"), Aspose.Network.Mail.MessageFormat.Msg);
     
  •  09-09-2009, 10:29 AM 197329 in reply to 195277

    Re: Saving MSG file loses properties from the Email Message .NET

     
  •  10-07-2009, 4:51 AM 201307 in reply to 195280

    Re: Saving MSG file loses properties from the Email Message

    Well it's now been over a month without hearing any further updates. I am going to recommend that we stop using your control, as it does not seem to do what we were lead to beleive it does i.e. Allow for the Creation of MSG files without Outlook.


     
  •  10-07-2009, 1:07 PM 201364 in reply to 201307

    Re: Saving MSG file loses properties from the Email Message

    The beta dll posted at http://www.aspose.com/community/forums/thread/196816/outlook-showing-a-message-while-opening-msg-file-created-with-aspose.network.aspx solves two bugs.
    1. Mail priority works correct
    2. "inetnet message - sender and content cannot be verified" message does not come anymore.
    We are still working on the attachments issue. It is taking time to fix due to the complexity of the msg format.

    Best Regards,
    Saqib Razzaq
    Support Developer, Aspose Sialkot Team
    http://www.aspose.com
    Your File Format Experts
     
  •  06-08-2010, 9:19 AM 242213 in reply to 201364

    Re: Saving MSG file loses properties from the Email Message

    Hi there,

    i've the same problem with the latest dll of Aspose.Network 5....

    This problem is fixed ? actually i'm working without license and

    i'm deciding to buy the license. Is there a solution ?

    thanks

    alle

     
Page 1 of 2 (16 items)   1 2 Next >
View as RSS news feed in XML