| Author |  | 
      
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Support,
           | Posted: 06 April 2014 at 3:05am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Using this code:
           | Posted: 07 April 2014 at 6:07am | IP Logged |   |  
           | 
 |  
 
| 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 |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Alex,
           | Posted: 07 April 2014 at 6:47am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Please provide the complete MIME source you want to get.
           | Posted: 07 April 2014 at 7:06am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          I now do:
           | Posted: 07 April 2014 at 7:10am | IP Logged |   |  
           | 
 |  
 
| 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          What exactly are you trying to achieve? Because what you get is certainly not a correct MIME source.
           | Posted: 07 April 2014 at 7:34am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Alex,
           | Posted: 07 April 2014 at 8:48am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          
           | Posted: 07 April 2014 at 8:54am | IP Logged |   |  
           | 
 |  [follow]...Or in S / MIME v3 CMS format: http://www.ietf.org/rfc/rfc3851.txt
 
 Can I use MailBee?
 
 Regards, Lello
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Alex,
           | Posted: 07 April 2014 at 11:44am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          Yes sure, S/MIME is fully supported by MailBee.NET Objects, this  page is a starting point of relevant documentation.
           | Posted: 08 April 2014 at 3:09am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Igor,
           | Posted: 08 April 2014 at 3:57am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          
           | Posted: 08 April 2014 at 4:00am | IP Logged |   |  
           | 
 |  
| 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 |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          I have to generate a "Mime" that contains only Attachments (not Plain Text, not Html Text).
           | Posted: 08 April 2014 at 4:07am | IP Logged |   |  
           | 
 |  
 
 
| 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 |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          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.
           | Posted: 08 April 2014 at 4:14am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Igor,
           | Posted: 08 April 2014 at 4:35am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          MailBee is only capable of creating detached signatures.
           | Posted: 08 April 2014 at 9:44am | IP Logged |   |  
           | 
 |  
 The signature will be detached into a separate MIME part which will be attached to the message.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Dear Alex and Igor,
           | Posted: 09 April 2014 at 1:16am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          I don't have any suggestions. Moreover, I don't see how deleting this section would keep the MIME structure correct.
           | Posted: 09 April 2014 at 3:17am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Alex,
           | Posted: 25 May 2016 at 2:35am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          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" .
           | Posted: 25 May 2016 at 3:21am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          In that case you can use Base64 encoding. To configure the encoding, you can use the properties:
           | Posted: 25 May 2016 at 5:01am | IP Logged |   |  
           | 
 |  
 MailMessage.MailTransferEncodingHtml
 MailMessage.MailTransferEncodingPlain
 
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Igor,
           | Posted: 25 May 2016 at 11:17am | IP Logged |   |  
           | 
 |  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 |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          
           | Posted: 25 May 2016 at 11:43am | IP Logged |   |  
           | 
 |  
| 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 |     | 
       
       
        |  | 
        | juris Groupie
 
  
 
 Joined: 27 June 2011
 Location: Italy
 Online Status: Offline
 Posts: 72
 | 
          Hello Igor,
           | Posted: 26 May 2016 at 3:33am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          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.
           | Posted: 26 May 2016 at 4:18am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  |