Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: System.Net.Mail.Message & Mailbee Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
efreitasrj
Newbie
Newbie


Joined: 01 August 2008
Location: Brazil
Online Status: Offline
Posts: 9
Posted: 13 August 2008 at 5:17pm | IP Logged Quote efreitasrj

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 View efreitasrj's Profile Search for other posts by efreitasrj
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 14 August 2008 at 3:03am | IP Logged Quote Andrew

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 View Andrew's Profile Search for other posts by Andrew
 
efreitasrj
Newbie
Newbie


Joined: 01 August 2008
Location: Brazil
Online Status: Offline
Posts: 9
Posted: 14 August 2008 at 7:17am | IP Logged Quote efreitasrj

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 View efreitasrj's Profile Search for other posts by efreitasrj
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 14 August 2008 at 11:11pm | IP Logged Quote Andrew

Try something like:

Code:
attMailAtt.ContentType = new System.Net.Mime.ContentType(mailBeeAtt.ContentType);


Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide