Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Howto remove this section Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 06 April 2014 at 3:05am | IP Logged Quote juris

Hello Support,

How can I remove (completely) the following sections from the "Mime"?
I've tried using "= msg.MailTransferEncodingPlain MailTransferEncoding.None" but it appears the same. Any suggestions?

Regards, Lello
====================================
------=_NextPart_000_5169_248B4492.347699CB
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Back to Top View juris's Profile Search for other posts by juris
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 07 April 2014 at 6:07am | IP Logged Quote Alex

Using this code:
Code:

MailMessage msg = new MailMessage();
msg.BodyPlainText = "hi";
msg.MailTransferEncodingPlain = MailTransferEncoding.None;
msg.BodyHtmlText = "hi";
msg.MailTransferEncodingHtml = MailTransferEncoding.None;
msg.SaveMessage(@"C:\Temp\test.eml");

I get this:
Code:

MIME-Version: 1.0
X-Mailer: MailBee.NET 8.0.2.440
Content-Type: multipart/alternative;
     boundary="----=_NextPart_000_E771_786ABF10.34233B2F"


------=_NextPart_000_E771_786ABF10.34233B2F
Content-Type: text/plain;
     charset="utf-8"

hi
------=_NextPart_000_E771_786ABF10.34233B2F
Content-Type: text/html;
     charset="utf-8"

hi
------=_NextPart_000_E771_786ABF10.34233B2F--

No Content-Transfer-Encoding header appears.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 07 April 2014 at 6:47am | IP Logged Quote juris

Hello Alex,

Using this code:
Code:
            
MailMessage msg = new MailMessage();
msg.Attachments.Add(@"test.txt");
msg.SaveMessage(@"test.eml");


I get this:
Code:

MIME-Version: 1.0
X-Mailer: MailBee.NET 7.2.2.366
Content-Type: multipart/mixed;
     boundary="----=_NextPart_000_1E92_5E6E07A4.D04141E5"


------=_NextPart_000_1E92_5E6E07A4.D04141E5
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


------=_NextPart_000_1E92_5E6E07A4.D04141E5
Content-Type: text/plain;
     name="test.txt"
Content-Disposition: attachment;
     filename="test.txt"
Content-Transfer-Encoding: base64

VGVzdA==
------=_NextPart_000_1E92_5E6E07A4.D04141E5--

Can I remove (completely) the following section from the "Mime"?
Code:

------=_NextPart_000_1E92_5E6E07A4.D04141E5
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


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

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 07 April 2014 at 7:06am | IP Logged Quote Alex

Please provide the complete MIME source you want to get.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 07 April 2014 at 7:10am | IP Logged Quote juris

I now do:
Code:

            MailMessage msg = new MailMessage();
            msg.Attachments.Add(@"test.txt");
            
            //Save the message
            msg.SaveMessage(@"test.eml");
            
            //Remove first Part from the Mime
            string boundary = "--" + msg.MimePartTree.Boundary;
            string text = File.ReadAllText(@"test.eml");
            int start = text.IndexOf(boundary);
            int length = text.IndexOf(boundary, start + 1) - start;
            text = text.Replace(text.Substring(start, length), "");
            File.WriteAllText(@"test.eml", text);



But it is not very elegant.
Alex, You know an easier way?

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

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 07 April 2014 at 7:34am | IP Logged Quote Alex

What exactly are you trying to achieve? Because what you get is certainly not a correct MIME source.

For instance, you get multipart with a single part inside.

I don't think it's possible to do what you want to with MailBee. And it's by design. With MailBee, you can't create incorrect MIME source (at least it's not easy, I hope).

Regards,
Alex

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


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 07 April 2014 at 8:48am | IP Logged Quote juris

Hello Alex,

I have to store my message in S / MIME v3 specifications: http://www.ietf.org/rfc/rfc2633.txt

Can I use MailBee?

regards, Lello
Back to Top View juris's Profile Search for other posts by juris
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 07 April 2014 at 8:54am | IP Logged Quote juris


[follow]...Or in S / MIME v3 CMS format: http://www.ietf.org/rfc/rfc3851.txt

Can I use MailBee?

Regards, Lello
Back to Top View juris's Profile Search for other posts by juris
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 07 April 2014 at 11:44am | IP Logged Quote juris

Hello Alex,

I need to create S/MIME messages using C# (as specified in RFC 2633, "S/MIME Version 3 message specification", and RFC 3335). Are MailBee libraries good to accomplish creating S/MIME messages, and in particular, .p7s files?

Even other people ask this: http://stackoverflow.com/questions/127363/s-mime-libraries-for-net

Regards, Lello
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 08 April 2014 at 3:09am | IP Logged Quote Igor

Yes sure, S/MIME is fully supported by MailBee.NET Objects, this page is a starting point of relevant documentation.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 08 April 2014 at 3:57am | IP Logged Quote juris

Hello Igor,

I have to generate a "Mime" that contains only Attachments (not Plain Text, not Html Text).
Code:

MailMessage msg = new MailMessage();
msg.Attachments.Add(@"test.txt");
msg.SaveMessage(@"test.eml");


Why You input (equally) the section "Text Body"?
Code:

------=_NextPart_000_1E92_5E6E07A4.D04141E5
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


I do not want to generate this section.
How can I remove (completely) the Body sections from the "Mime"?

Regards, Lello
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 08 April 2014 at 4:00am | IP Logged Quote Igor

Quote:
I have to generate a "Mime" that contains only Attachments (not Plain Text, not Html Text).


That approach is not supported by MailBee, body text must be there.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 08 April 2014 at 4:07am | IP Logged Quote juris

I have to generate a "Mime" that contains only Attachments (not Plain Text, not Html Text).

Code:

MailMessage msg = new MailMessage();
msg.Attachments.Add(@"Index.xml");
msg.Attachments.Add(@"Attachment1.p7m");
msg.Attachments.Add(@"Attachment2.p7m");
msg.Attachments.Add(@"Attachment3.p7m");
msg.SaveMessage(@"Test.msg");


This code remove first part (body section)
But it is not very elegant.
You know an easier way?

Code:

//Remove first Part from the Mime
string boundary = "--" + msg.MimePartTree.Boundary;
string text = File.ReadAllText(@"test.eml");
int start = text.IndexOf(boundary);
int length = text.IndexOf(boundary, start + 1) - start;
text = text.Replace(text.Substring(start, length), "");
File.WriteAllText(@"test.eml", text);
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 08 April 2014 at 4:14am | IP Logged Quote Igor

It's not really done that way, .p7m is not a generic attachment, and content-type there needs to be different. You need to generate the signature by signing the message, encrypting it or doing both.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 08 April 2014 at 4:35am | IP Logged Quote juris

Igor,

The Italian Ministry of Justice asks for a file s / mime that contains only p7m x509 signed.

After I created the file s / mime (without Plain Text, not Html Text) I have to encrypt the message with the public key x509 of the recipient.


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

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 08 April 2014 at 9:44am | IP Logged Quote Alex

MailBee is only capable of creating detached signatures.

The signature will be detached into a separate MIME part which will be attached to the message.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 09 April 2014 at 1:16am | IP Logged Quote juris

Dear Alex and Igor,

I have no problem with digital signature and encryption.
My problem is to delete the following section from the file "MIME"
Do you have any suggestions?

Code:

------=_NextPart_000_1E92_5E6E07A4.D04141E5
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


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

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 09 April 2014 at 3:17am | IP Logged Quote Alex

I don't have any suggestions. Moreover, I don't see how deleting this section would keep the MIME structure correct.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 25 May 2016 at 2:35am | IP Logged Quote juris

Hello Alex,

I confirm that the Italian Ministry of Justice does not accept a MIME that contains section "Content-Transfer-Encoding: quoted-printable"

Regards, Lello
Back to Top View juris's Profile Search for other posts by juris
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 25 May 2016 at 3:21am | IP Logged Quote juris

It is a MIME-encrypted and encrypted. This MIME must be attached to a normal email. This MIME must be no section "Content-Transfer-Encoding: quoted-printable" .
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 25 May 2016 at 5:01am | IP Logged Quote Igor

In that case you can use Base64 encoding. To configure the encoding, you can use the properties:

MailMessage.MailTransferEncodingHtml
MailMessage.MailTransferEncodingPlain

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 25 May 2016 at 11:17am | IP Logged Quote juris

Hello Igor,
I set "NONE" for plain-formatted body and for HTML-formatted body but but I can not delete the section "Content-Type" (see screenshot)

========================================
// Set the NONE encoding for plain-formatted body.
msg.MailTransferEncodingPlain = MailTransferEncoding.None;

// Set the NONE encoding for HTML-formatted body.
msg.MailTransferEncodingHtml = MailTransferEncoding.None;
========================================

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


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 25 May 2016 at 11:43am | IP Logged Quote juris

juris wrote:
Hello Igor,
I set "NONE" for plain-formatted body and for HTML-formatted body but but I can not delete the section "Content-Type" (see screenshot)

========================================
// Set the NONE encoding for plain-formatted body.
msg.MailTransferEncodingPlain = MailTransferEncoding.None;

// Set the NONE encoding for HTML-formatted body.
msg.MailTransferEncodingHtml = MailTransferEncoding.None;
========================================



=============================
This mime does not have a Body
I do not use this mime to send a message.
I use this mime like it a file container.
Back to Top View juris's Profile Search for other posts by juris
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 67
Posted: 26 May 2016 at 3:33am | IP Logged Quote juris

Hello Igor,

If I use these properties:
============================
msg.Charset = null;
msg.MailTransferEncodingPlain = MailTransferEncoding.None;
msg.MailTransferEncodingHtml = MailTransferEncoding.None;
=============================

Mime output is this:



=================================================

Is there a way to also eliminate "Boundary" and "Content-Type: text / plain"?
NOTE: I do not use this mime to send a message. I use this mime like a file container.

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

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 26 May 2016 at 4:18am | IP Logged Quote Alex

It's not possible. E-mails generated by MailBee cannot contain only attachment with no text body at all. All emails with attachments must bear "multipart" content type, have boundary, etc.

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

Page of 2 Next >>
  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

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