Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: MIME Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 30 June 2023 at 6:19pm | IP Logged Quote adam.kozovo

Hello support

Working on a customized contact/calendar processor, Upgrading from System.Net.Mail, does your mime .net sdk support this?

eml.AlternateViews.Add(New AlternateView(ms, New ContentType("text/vcard")))

ms is MemoryStream holding the vcf vCard contents.
So need to initialize a new eml mime email instance and add a text/vcard bodypart with the contents taken from memory stream, then save it, that simple.
Thanks for advise.

Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 30 June 2023 at 6:28pm | IP Logged Quote adam.kozovo

Found this, but not sure if can help, this adds an attachment rather than body part.
https://afterlogic.com/mailbee-net/docs/ical_and_vcard.html
Create vCard with photo and send it as e-mail
// Add vCard as attachment.
msg.Attachments.Add "application/octet-stream"
Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 03 July 2023 at 12:32am | IP Logged Quote Alex

Hello Adam,

https://afterlogic.com/mailbee-net/docs/#ical_and_vcard.html#CreateEvent

Here it creates text body part and then fills with the content generated with iCalVCard lib but you can use any other string as the source.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 03 July 2023 at 9:29pm | IP Logged Quote adam.kozovo

Thank you for the sample, is this iCalVCard lib included with your mail SDK and royalty free?
For calendar will support both v1 vcs and v2 ics?
For contact will support vcf 2.1, 3.0 or 4.0?
Furthermore, seems that main mail message class will alter and damage the mail structure after setting basic properties, how am I being supposed to attach a sample project demonstrating this behave to be inspected?
Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 04 July 2023 at 12:03am | IP Logged Quote Alex

Yes, it's included.

However, ICalVCard is no longer in active development. We published it as there was no stable known implementation of iCal back then but now it is available.

We recommend using iCal.NET at https://github.com/rianjs/ical.net and MixERP.Net.VCards https://github.com/mixerp/MixERP.Net.VCards instead.

iCal.NET is based on the same code we used in iCalVCard so transitioning is quick.

Quote:
Furthermore, seems that main mail message class will alter and damage the mail structure after setting basic properties, how am I being supposed to attach a sample project demonstrating this behave to be inspected?


Not sure what the issue is. What exactly gets damaged, etc.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 04 July 2023 at 1:11am | IP Logged Quote adam.kozovo

Email's content type is multipart/alternative

If I load it to the Mailmessage class and immediately save it back, it's fine, if I set a property then save it, a multipart/mixed header will be added to the top of message, causing damage to the body of message, where can I upload a sample?
Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 04 July 2023 at 3:35am | IP Logged Quote Alex

Could you post the code snippet (with everything hardcoded) to demonstrate your issue?

This works for me (it stays multipart/alternative):
Code:

msg.BodyPlainText = "text here";
msg.BodyParts.Add("text/calendar; method = REQUEST").Text = "ics here";
msg.SaveMessage(@"C:\Temp\1.eml");
msg.LoadMessage(@"C:\Temp\1.eml"); // This can be removed, no difference
msg.Subject = "subj"; // Set some property
msg.SaveMessage(@"C:\Temp\2.eml");


Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 04 July 2023 at 3:45pm | IP Logged Quote adam.kozovo

The whole code:

Using MailMessage As New MailMessage
    MailMessage.LoadMessage("E:\Message.eml")
    'Compare export 1
    MailMessage.SaveMessage("E:\WithoutX.eml")

    MailMessage.XMailer = "Some string"
    'vs export 2
    MailMessage.SaveMessage("E:\WithX.eml")
End Using

The key is using the code against such messages, I've uploaded one sample here:


https://mega.nz/file/KWwzmRZb#88r2t2y4L3TArJ6wyxEnKUWHc4o30K1sHrrxk1RexZM
Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 04 July 2023 at 7:24pm | IP Logged Quote adam.kozovo

https://afterlogic.com/mailbee-net/docs/MailBee.ErrorCodes.html

The MailBee classes implementing LastResult property are:

    Smtp class (LastResult property)
    Pop3 class (LastResult property)
    Imap class (LastResult property)
    MailMessage class (LastResult property)
    Attachment class (LastResult property)
    AttachmentCollection class (LastResult property)

The following table lists all the error codes in ascending order:

Smime Class which was referred from its help page does not exist in help.
So is LastResult valid for Smime results too?
Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 05 July 2023 at 1:32pm | IP Logged Quote Alex

Thanks, this helps.

MailMessage.XMailer = "Some string"
msg.Builder.BuildHeaderOnly = True
MailMessage.SaveMessage("E:\WithX.eml")

This will let MailBee know you want to keep the message structure intact.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 05 July 2023 at 1:35pm | IP Logged Quote Alex

Yes, Smime.LastResult does exist:

https://afterlogic.com/mailbee-net/docs/#MailBee.Security.Smime.LastResult.html

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 05 July 2023 at 6:23pm | IP Logged Quote adam.kozovo

Thank you but I'm not so sure if it really helps because this is not something an algorithm can detect when to set the BuildHeaderOnly on or off?

Are you sure it's building the body correctly when encountering the text/calendar and text/vcard parts?
Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 06 July 2023 at 12:48am | IP Logged Quote Alex

Your algorithm can be pretty basic - if you need to change something in the header but not in the body, you set BuildHeaderOnly.

Quote:

Are you sure it's building the body correctly when encountering the text/calendar and text/vcard parts?

Sure thing, there is always space for improvement. But currently it's the way it is.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
adam.kozovo
Newbie
Newbie


Joined: 30 June 2023
Online Status: Offline
Posts: 19
Posted: 07 July 2023 at 7:13pm | IP Logged Quote adam.kozovo

Thank you for your note, but what you suggested is impossible, because the real use is not what I've pasted above, almost most of my usage is importing different kind of emails, so always a new instance of bee emailmessage is initialized and load message from stream will be used, both body and headers are altered, the question is that if you consider this as improvement or bug fix? And if .net api is under active maintenance? If yes, I'm sure the developers will fix it, if you kindly forward the case to them, because this is actually a major bug.
Back to Top View adam.kozovo's Profile Search for other posts by adam.kozovo
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 10 July 2023 at 4:47am | IP Logged Quote Alex

Hi,

it's a bit complicated. The original behavior considered MIME parts with filenames in them attachments. But text/calendars parts do have filename although they are not really attachments. I adjusted the logic a bit so they would be considered text parts. This is probably more correct but may require modifications in software which relied on the old behavior (although it has never been documented).

https://afterlogic.com/updates/mailbee_net.zip

Regards,
Alex

Back to Top View Alex's Profile Search for other posts by Alex
 

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