Archived Forum Post

Index of archived forum posts

Question:

SMIME Decrypted mails has no line feed

Mar 28 '13 at 04:29

Hi, We are reading the SMIME encrypted emails from the pop3 server using mailman component.

Its successfully decrypting the SMIME content, But we are facing linefeed issue,

E.g The original email body contains the following content before encrypting. The content (plain text) encrypted using our own digital certificate and private key. i/p:

################################################################################
#                   CONTENT  HERE                                              #                                                   
#               S T A T U S   -   R E P O R T                                  #                                              
################################################################################

o/p :But after decrypting the mail, there was a long line instead of the above boxed # region, shown below,

################################################################################- #-----------------------------CONTENT-HERE----------------------------------------- #- #----------S-T-A-T-U-S------R-E-P-

We are not sure, what we’ve missed while decryting the SMIME content, But our customer wants exactly as the input with boxed ‘#’ region. Fyi, the result contains no CRLF/LF on the boxed '#' region and all the whitespaces replaced by ‘-’ symbol. But other contents in the body has no CRLF issue. Its shown just like in the i/p.

We are decrypting the content from 2 scenarios(our requirements),

  1. we’ve used the following code segment for decrypt the content in email textfile.
    MailMan mailman = new MailMan();
    Email email = new Email();
    bool success = mailman.UnlockComponent("license key");
    mailman.SetDecryptCert2(objCert, objPrivateKey);
    email = mailman.LoadEml(filename);
    string decrypted = email.GetMime();
    

2.And the below code segment for decrypt the email from pop3 server,

MailMan mailman = new MailMan();
Email email = new Email();
bool success = mailman.UnlockComponent("license key");
mailman.MailHost = hostName;
mailman.MailPort = port;
mailman.PopSsl = useSSL;
mailman.PopUsername = mailUserName;
mailman.PopPassword = Password;
mailman.ReadTimeout = readTimeOut;
mailman.SetDecryptCert2(objCert, objPrivateKey);
Chilkat.StringArray chilkatUidlArray = mailman.GetUidls();
string uidl = chilkatUidlArray.GetString(index);
email = mailman.FetchEmail(uidl);
string decrypted = email.GetMime();

both code segment gives the same result. i.e a long line instead of the boxed # region. Needs help.


Answer

The call to email.GetMime() returns the full MIME representation of the email, which of course will include the body typically encoded using a content-transfer-encoding such as quoted-printable, bsae64, etc. You are probably looking at the quoted-printable encoding of the body.

If you want the body text, access the "Body" property of the email.


Answer

Thanks for the quick answer, Actually i'm getting the '#' region value under the 'Header' property not on the 'Body' property thats why i've used the GetMime() method. It seems its append to the header values. My Header :

Message-ID: 20631685.1349796827856.abc@def.com Date: Sat, 9 Jan 2013 10:33:47 -0500 (CDT) To: test@abc.com From: test@abc.com Subject: testing MIME-Version: 1.0 Content-Disposition: attachment; filename="smime.p7m" Content-Type: application/x-pkcs7-mime; name="smime.p7m" Content-Transfer-Encoding: base64 Content-Length: 19217

##########################################################################- #-----------------------------CONTENT-HERE----------------------------------------- #- #----------S-T-A-T-U-S------R-E-P-

Still couldn't get exactly as the i/p. Needs help.