Hi,<br><br>We have been evaluating the Netwwork library and using it for working with mail messages.<br><br>Everything has worked well until we licensced the component, now the message formats seem to be changing slightly when we save them, and are unreadable on some email clients. This is not a license error, as everything else is fine, there just seems to be a small difference in how a licensced vs non-licensed version behave when saving a file. <br><br>Any thoughts?<br><br>Thanks!<br><br>Here is a sample:<br>//If the following license lines are commented out, the email file is fine<br> //If they are uncommented, it apears to change the file slightly, and it cannot be read in some //clients<br> // Aspose.Network.License license = new Aspose.Network.License();<br> //Pass only the name of the license file embedded in the assembly<br> // license.SetLicense("Aspose.Network.lic"); //From Embedded Resource<br><br> Aspose.Network.Mail.MailMessage mm = new Aspose.Network.Mail.MailMessage();<br> mm = Aspose.Network.Mail.MailMessage.Load(mesageSaveToPath);<br> mm.Headers.Add("myheader", "myVal");<br> mm.Save(mesageSaveToPath, Aspose.Network.Mail.MessageFormat.Eml);<br>
After some more investigating, it appears that the unlicensed version is creating a message content type of multipart/mixed while the licensed version is creating text/html. I assume this is because the unlicensed version is adding an attachment (license.txt) to all messages, while the licensed version is not.
So how can I set the licensed version to emulate the same message type as the unlicensed version (without the attachment)?
Thanks!
Here are the differences I see in the email files being created:
Unlicensed Version:
Content-Type: multipart/mixed;
boundary="------_=_NextPart_001_A6E514FD.4A4DAA4F"
…….(HEADERS ARE HERE)
…..
--------_=_NextPart_001_A6E514FD.4A4DAA4F
Content-Type: text/html;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-class: urn:content-classes:message
MIME-Version: 1.0
Date: Wed, 5 Sep 2007 16:06:38 -0400
(BODY STARTS)
Licensed:
Content-Type: text/html;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-class: urn:content-classes:message
…….(HEADERS ARE HERE)
…..
(BODY STARTS)
Hello,
The original ExchangeMessage.Eml does not contain multiparts. It only contains one message body for Html format. Therefore, the MailMessage only outputs with single parts -- text/html. I think it is not a bug in the MailMessage.
In order to get multi-part in the Eml message, you can add a simple text body into it.
MailMessage msg = MailMessage.Load(@"ExchangeMessage.eml", MessageFormat.Eml);
if (msg.TextBody == null)
msg.TextBody = "This message is about blablabla"; //add text body
msg.Save(@"ExchangeMessage2.eml");
Please let me know if it works.
Thank you very much.
Hi,
Thank you for the response.
I have tried this, and it does not work for us on the clients (They just display the textbody we created and not the actual email message).
I realize that the Exchange message is not multi-part, that is the reason we licensed ASPOSE.Network, so it could format this message correctly for us (as it did in the trial version of Aspose.network)
Is there any other way to get the message formatted as it was during the trial (unlicensed) version of Aspose.Network? Thanks for your prompt attention to this – we are ‘production down’ with our product until it can be resolved.
Hello,
Thanks for your updates.
It's fine. I will try to get a workaround solution for your shortly.
One more question, what mail client are you using?
Thanks,
Our customers have multiple email clients. The ones that seem to be causing the most issues here are Mac based (Mac Mail).
The sample emails I sent last week show a message that will work on the problem clients.
Also, this morning I have found that if I Add an attachment with Aspose.Network, and then remove that ‘part’ from a 3rd part component, the message will also work. I’ll send a sample of that to you.
Thanks again!
-Ed
Hello,
Could please post your code to me? According to the standard, the multipart/mixed is used when some attachments are in the mail. I am trying to add an interface to set the multipart/mixed directly, in order to fix this issue.
Send me you code and generated Eml files. I will investigate more about it.
Thanks,
Hi iret,
Thank you for the help. I have just sent a message with attachments to the guangzhou email address.
Please let me know if you need anything else.
Hello,
I have made some changes – an EmptyAttachement class is added, which will not save to Eml file.
http://www.aspose.com/products/Aspose.Network/Releases/3.5.3/Aspose.Networkv3.5.3.4.zip
[Sample]
MailMessage msg = MailMessage.Load(@“c:\ExchangeMessage.eml”, MessageFormat.Eml);
msg.Attachments.Add(new EmptyAttachment());
msg.Save(@“c:\exchangeeml.eml”);
Let me know if it works,
Thanks
Thank you very much! I will try this and let you know how it works.
I just tried the file above, and it looks like it may be the wrong link. I sent you an email with more info.
Please download it agian. I have uploaded a new one to the previous link.
Sorry for my mistakes.
Thanks
This seems to be working for us, thank you!!
Will this class (EmptyAttachment) be included in future releases as well? Is the DLL I downloaded safe for ‘production use’?
Thanks again for all the help here!
Hello,
We will release a public hotfix before next week. We will have a small design change on this issue:
We will add a new property called EmptyAttachment to class Attachment, instead of exposing the EmptyAtachment class directly.
So you can use Attachment.EmaptyAttachment as the EmptyAttachment.
Thanks