Author |
|
efreitasrj Newbie
Joined: 01 August 2008 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 13 August 2008 at 5:17pm | IP Logged
|
|
|
Hi,
I need to transform a MailBee.Mime.AttachmentCollection.
When I loop through it, I am not able to load each MailBee.Mime.Attachment into a System.Net.Mail.Message, as below:
foreach (MailBee.Mime.Attachment att in this.attachmentCollection)
{
msg.Attachments.Add(att);
}
It raises a compiling error, telling me its not possible to convert it...
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 14 August 2008 at 3:03am | IP Logged
|
|
|
That's expected behavior because MailBee.NET has different from System.Net.Mail object model and their types are not compatible.
To add MailBee.Mime.Attachment to System.Net.Mail.Message, you should convert it, i.e get attachment raw data and create System.Net.Mail compatible attachment object to add it to System.Net.Mail.Message.
Best regards,
Andrew
|
Back to Top |
|
|
efreitasrj Newbie
Joined: 01 August 2008 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 14 August 2008 at 7:17am | IP Logged
|
|
|
Well thats fine, it works, now the only thing still left is how to how to convert the ContentType from an object to another.
See this:
attMailAtt.ContentType = mailBeeAtt.ContentType;
just doesnt work, because System.Mail.Mime.ContentType is not a string, where as mailBeeAtt.ContentType is!
So how should I proceed??
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 14 August 2008 at 11:11pm | IP Logged
|
|
|
Try something like:
Code:
attMailAtt.ContentType = new System.Net.Mime.ContentType(mailBeeAtt.ContentType); |
|
|
Best regards,
Andrew
|
Back to Top |
|
|