This project is read-only.

Attachment special character issue / \:?"<>

Sep 15, 2014 at 3:14 PM
I am facing problem if attachment is having special character's like / \:?"<>
if i attached file like abc/1"?<>.pdf its taking file like 1"\ please suggest any solution for this.
Sep 16, 2014 at 5:58 AM
hi,

Please give me solution for this issue as its pending from so many days.MAC machine allowing such type of character but Windows machine not.
Sep 17, 2014 at 8:56 AM
Edited Sep 17, 2014 at 8:57 AM
Hi.

I could not reproduct your bug.
Because you don't show me the actual code and environment information(OS, Mail server or other things...) that reproduct your problem.
So, I take so many days to reply to you.
If you want to solve your problem in short time, please show me these 3 things.
1.Entire reproduct code and environment information
2.Expected behavior
3.Actual result
Please refer this page and show me the detail information about these 3 things.
http://www.joelonsoftware.com/articles/fog0000000029.html
With above information, we may solve this issue more short time.


And here is a my test code in latest version.
var cl = new SmtpClient("smtp.live.com", 587, "xxx@hotmail.com", "xxx");
cl.EncryptedCommunication = SmtpEncryptedCommunication.Tls;

SmtpMessage mg = new SmtpMessage();
mg.From = new MailAddress("xxx@hotmail.com");
mg.To.Add(new MailAddress("yyy@gmail.com"));
mg.Subject = "AttachedFile contains special chars";
mg.BodyText = "This is body text.";

SmtpContent ct = new SmtpContent();
ct.LoadData(System.IO.File.ReadAllBytes("C:\\Temp\\MyTest1.txt"));
ct.FileName = "/ :?<>.txt";
ct.Name = ct.FileName;
mg.Contents.Add(ct);

var result = cl.SendMail(mg);
And GMail shows same file name.

Image


I'll reply when you give me above 3 things information.

regards.
Sep 25, 2014 at 6:45 AM
U can reproduct this bug just follow below steps
1.Rename file name in MAC pc from abc.pdf to abc/1"?<>.pdf and send mail with attachment.
2.Access that mail in WINDOWS pc and run this code which i have attach below.
3.Run this code on WINDOWS pc and check attached file name its taking file like 1?\ something like this. please suggest any solution for this.
i have attached 2 files in higlabos ISSUE's forum u can get code from there.
Sep 25, 2014 at 7:20 AM
Hi Higty I am too facing this problem will you please look into this... Or the best thing we can do is we can have a call on skype ?

Please let us know what should we do from our end to simulate the problem @ your end. Do reply to my message. !!!
Sep 25, 2014 at 9:00 AM
Hi.

I confirmed your 2 image file.
But I could not reproduct your bug because I could not get entire source code to reproduct your bug.
Please post entire source code as text and I hope that it is as small as possible to reproduct your bug.
Small source code helps me to solve your problem in short time.

Or I want to get raw text data when you send a mail from MAC pc.
You can get actual raw text by calling GetRawText method of SmtpMessage object.


regards.
Oct 9, 2014 at 4:46 PM
Edited Oct 9, 2014 at 5:25 PM
Hi Higty, Can we talk on Skype ? Please

I found some weird error when i scanned the bodyText I found my File Name but when I try to access Via Property
__
--001a11c3baa0c5c6dd0504ff12f2
Content-Type: text/html; charset=UTF-8
<div dir="ltr"><br><div class="gmail_quote"><br><br><div dir="ltr"><br></div> </div><br></div> __--001a11c3baa0c5c6dd0504ff12f2--
--001a11c3baa0c5c6e10504ff12f4
Content-Type: application/pdf; name="?:@,,\"\".pdf" Content-Disposition: attachment; filename="?:@,,\"\".pdf" Content-Transfer-Encoding: base64
X-Attachment-Id: f_i1296l050
__
JVBERi0xLjQKJeLjz9MKMiAwIG9iago8PC9MZW5ndGggMzE+PnN0cmVhbQpxCjYxMiAwIDAgNzky
IDAgMCBjbQovSW0wIERvClEKCmVuZHN0cmVhbQplbmRvYmoKMyAwIG9iago8PC9JbnRlbnQvUmVs
YXRpdmVDb2xvcmltZXRyaWMvRGVjb2RlUGFybXM8PC9Db2xvcnMgMy9Db2xvclRyYW5zZm9ybSAx
L1Jvd3MgMTY1MC9RRmFjdG9yIDAuMC9Db2x1bW5zIDEyNzUvSFNhbXBsZXNbMSAxIDEgMV0vQmxl
bmQgMS9WU2FtcGxlc1sxIDEgMSAxXT4+L1R5cGUvWE9iamVjdC9Db2xvclNwYWNlL0RldmljZVJH
Qi9TdWJ0eXBlL0ltYWdlL05hbWUvfnBzQkZBMy5qcGcvV2lkdGggMTI3NS9CaXRzUGVyQ29tcG9u
ZW50IDgvSW1hZ2VOYW1lL35wc0JGQTMuanBnL0xlbmd0aCAxMzY2ODg3L0hlaWdodCAxNjUwL0Zp
__

Image
Oct 10, 2014 at 7:16 AM
Hi.

Sorry, I can not have enough time to support you by skype.
Please show me your reproduct code that create your BodyText.

regards.
Oct 10, 2014 at 8:44 AM
Please find below code

using (ImapClient objImapClient = new ImapClient(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["MailingServerName"])))
                {
                    #region Get configuration of server using IMAP
                    objImapClient.ServerName = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["MailingServerName"]);
                    objImapClient.Port = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ImapPort"]);
                    objImapClient.Ssl = true;
                    objImapClient.ReceiveTimeout = 1000000;

                    objImapClient.UserName = objGenericInvoicesImport.EmailID.ToLower().Trim();        //// Enter Email server user Name 
                    objImapClient.Password = objGenericInvoicesImport.Password;                                 ////  Enter Email server password  
                    #endregion
                    // Authenticating the Username and Password which is stored on the server

                    if (objImapClient.Authenticate())
                    {
                        // Added by Pratik,19 Aug 2014 : Downloading all the emails and getting the actual email count                                                                                
                        ImapFolder MailFolder = objImapClient.SelectFolder("INBOX");
                        SearchResult list = objImapClient.ExecuteSearch("UNDELETED");

                        strLogFileBuilder.AppendLine("Total Emails to process: " + list.MailIndexList.Count);
                        strLogFileBuilder.AppendLine("");

                        for (int j = 0; j < list.MailIndexList.Count; j++) // Looping through emails                                                                                                       
                        {
                            if (objImapClient.State == ImapConnectionState.Disconnected)
                            {
                                objImapClient.Authenticate();

                                MailFolder = objImapClient.SelectFolder("INBOX");
                                list = objImapClient.ExecuteSearch("UNDELETED");

                                j = 0;
                            }

                            MailMessage objMailMessage = objImapClient.GetMessage(list.MailIndexList[j]);          // Getting the Current Message                                                                                            
                            List<MailContent> lstAllMailContent = MailMessage.GetAttachedContents(objMailMessage); // Getting only those content which having attachment otherwise the list will be empty
                            List<MailContent> lstMailContent = new List<MailContent>();
                            List<MailContent> lstMailPdfList = new List<MailContent>();
                            List<MailContent> lstMailXlsList = new List<MailContent>();
                            List<MailContent> lstAttachmentNotFoundInFolder = new List<MailContent>();
                            List<MailContent> lstMailDocList = new List<MailContent>();
                            List<MailContent> lstOtherFileType = new List<MailContent>();

}
}
Oct 10, 2014 at 8:53 AM
Hi, rickjackson.

Please give me entire text of this BodyText by attached file.
I'll investigate it.

regards.
Oct 30, 2014 at 10:37 AM
Hi Higty,

I have attached entire bodyText of below file name. You can refer below file name.Using this file name its easier for you to reproduced this issue.
CPK_052114_0510_a"_07.pdf

file name which i found is
CPK_052114_0510_a\
Nov 3, 2014 at 5:26 AM
Edited Nov 3, 2014 at 5:38 AM
Please give me reply. i am waiting for your reply i have attached bodytext in issues tab for CPK_052114_0510_a"_07.pdf file name.

here i have also created Link to download bodyText.

http://speedy.sh/kKCyr/BodyText-1.txt
Nov 3, 2014 at 3:11 PM
Higty will you please reply on this.
Nov 4, 2014 at 8:53 AM
Hi.

Thank you for your uploading BodyText-1.txt file.
I'll check it this week.
Please wait.
Nov 7, 2014 at 12:06 AM
Hi.

I could not find what is wrong.
Please give me original raw source of your mail.
I'll check it to solve your problem.


regards.
Nov 10, 2014 at 4:59 AM
Hi,

I am actually not getting which raw source your looking for but i have created link where you can download raw source for email.

here is a link to download raw source of email.

http://speedy.sh/c3xdT/Raw-source-Email.txt
Nov 12, 2014 at 3:11 AM
Hi.

That is not what I'm looking for.
I'm looking for raw souce like below.
From: Mike <xxx@xxx.com>
Subject: Please confirm your account!
Message-Id: <xxxxxxx>
Date: Tue, 11 Nov 2014 02:38:42 +0000
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="_av-CBv5t6nWFDt4e1or-ZEeiA"

--_av-CBv5t6nWFDt4e1or-ZEeiA
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Welcome to forums! 

--_av-CBv5t6nWFDt4e1or-ZEeiA
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html>

<html>

<body>
...Omitted
With it, I can work to solve your problem.
Nov 12, 2014 at 1:05 PM
Hi,

Here is a link to download raw source of email.

http://speedy.sh/7gaBk/Mac-Issue-bodyData.doc
Nov 13, 2014 at 2:43 AM
I test with your attached file data but I could not.
Because your file don't have entire raw data, so I could not test with your file.
So, I create new file with your file data that may reproduct your problem.
As you can see, this data has attached file which file name is CPK_052114_0510_a\"_07.pdf.
And saved it as C:\Temp\MimeTest9.txt.
Entire raw data of this file is below.
MIME-Version: 1.0
Date: Fri, 14 Feb 2014 13:12:31 +0000
From: =?iso-2022-jp?B?GyRCTmtMWjBsTzobKEIgPHN1enVraUBnbWFpbC5jb20+?=
Subject: =?iso-2022-jp?B?U3ViamVjdCAbJEJEOSQkN29MPiEhGyhCMDEyMzQ1Njc4OQ==?=
    =?iso-2022-jp?B?MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTA=?=
    =?iso-2022-jp?B?MTIzNDU2Nzg5?=
X-Priority: 3
To: =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEIwIDxoYW5ha29fMEBnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEIxIDxoYW5ha29fMUBnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEIyIDxoYW5ha29fMkBnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEIzIDxoYW5ha29fM0BnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEI0IDxoYW5ha29fNEBnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEI1IDxoYW5ha29fNUBnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEI2IDxoYW5ha29fNkBnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEI3IDxoYW5ha29fN0BnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEI4IDxoYW5ha29fOEBnbWFpbC5jb20+?=
    , =?iso-2022-jp?B?GyRCTmtMWjJWO1IbKEI5IDxoYW5ha29fOUBnbWFpbC5jb20+?=
Content-Type: multipart/mixed;
    charset="iso-2022-jp";
    boundary="bc5029de-812e-4e26-bcc2-d70df3148f66"
Content-Transfer-Encoding: Base64

--bc5029de-812e-4e26-bcc2-d70df3148f66
Content-Type: text/plain;
    charset="iso-2022-jp";
Content-Transfer-Encoding: Base64

GyRCNUAxYEA6PEskTj5iJE5APBsoQg0KGyRCPXQ5VEw1Pm8kTjZBJC0kIiRqGyhCDQobJEI6
O01lQVA8eSROMlYkTj8nGyhCDQobJEJAOTxUSSw/aiROTX0kciQiJGkkbyQ5GyhCDQo=
--bc5029de-812e-4e26-bcc2-d70df3148f66
Content-Type: Image/png;
    charset="iso-2022-jp";
    Name="CPK_052114_0510_a\"_07.pdf";
Content-Disposition: attachment;
    FileName="CPK_052114_0510_a\"_07.pdf";
Content-Transfer-Encoding: Base64

iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAE1mlDQ1BJQ0MgUHJvZmlsZQAA
eJzllWtMk3cUxp/37R2otFCLTNFXxhBZYR2grEII0CEDEbBUoIx09iZUW3jzUhFkUxlG8IYX
mMrChhIUlWwuKA4ZzhsToolDzJDhvGA13hBvgwREuw9d5INxyT57Pj15knNyzj/5/R+Af1RH
0xYSgDXPxqjiY6lMTRbF6wUXfEjgCU+doYCOSU1NwltrpBcEAFwO0tG0pSlpvulm6/X5vgP6
DY+OBxnf3gcAEDKZmiyAoABIcpw6DIBE79SfAZCstNE2gMgGIDHk6owAQQOQMWqVEiBqAYzn
qFVKgNwNYFyvVikBVjWA8UJDjg1gbwMgzzOa8wD2KYA1yWgqMAC8bgAbDTRjA/jZAIKs1nwj
wN8MICBTk0U518xfBygOAqTPhLcEwE85gPTxhDdLBUi9gDbphPd8BggAxCc/FywNDQEAEOI2
gO/ncAzVAC6VwMt5DseY2OEY7wE4MqBpumEFU/jvGxUBYMEFXpiNGGhRikPoJ8REClFN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EODbSkUELNg3T0x0hHFkQslLo56mAVQ
3JAAYUDfiEdjJkJrLkpd0sELhaitcGxF55lx1jW4FKsabYSMa1ObcOi+UqElO1W/5p4YTyxP
UaxqXvuynwebE6xvchmraLKuTTbusKfz8ixBeNN74OMTQzy6LE17rYWqtVjVHMONKsqeoTZu
c/b0EM+0p0jELH7rK2MZRd+wIiyUUTk1Wx817Hogx8TwBEsUbNmQIONaFCdD3vT13AlIGFAo
enzzk0cXQpMT0n2mQj4FgVHsfm0tpwc8Pviil0pVU1+fJB0Tdjx5Hye6Jzg4VKKru0QuOVvf
1Wv4rPNPdr9fpj6jmPAE05q5DmA2AWXCwOjJSUs7MXq00BMIdfdnyKYiLFnscmnUo7ktzQvN
KSylSCZshkc9amIW61fmGKpL8OCmRkZGfbLpCFobVi7Nks3Ead9sc6qnTN+4hy6HjFc0Oqgi
OjQANlBPw/odGOqJZhBlIxaUPc1gyeeP4SpnBye5UvSphIIBQiMkXAdjhJijyGciJGM2ddko
8ZiFHxhsC/I1UWpcm3vrXVY1Jljd4LJqkUNrZIRIOH5u8NfDnytgO7HUanX/c68TcZuVUmqB
N+lvSUSEYHJATu9/m2DyZwWsABoBl6mf1JlLJMz8tM6t62tvt3e7MwQYB/oVEJ1e6qaGuRrn
OvhOIDA3hAAamP/z+b/XX1p5j5ZC2qneAAAAAElFTkSuQmCC
--bc5029de-812e-4e26-bcc2-d70df3148f66--
And execute below code against to this file.
var parser = new HigLabo.Mime.MimeParser(Encoding.UTF8, 20000);
parser.Filter.LoadMessageRawData = true;
//parser.Filter.LoadContentRawData = true;
HigLabo.Mime.MailMessage mg = null;
var path = "";
path = "C:\\Temp\\MimeTest9.txt";
using (var str = new FileStream(path, FileMode.Open))
{
    var sr = new StreamReader(str, Encoding.UTF8);
    var text = sr.ReadToEnd();
    parser.Encoding = Encoding.UTF8;
    mg = parser.ToMailMessage(text);
    Console.WriteLine(mg.Contents[1].Name);
    Console.WriteLine(mg.Contents[1].FileName);
}
CPK_052114_0510_a\"_07.pdf is shown on console window.
My library just show exact file name on above step.
Is there anything missing?
Nov 13, 2014 at 5:37 AM
Edited Nov 13, 2014 at 5:38 AM
Hi,

Please try using below file name in windows and check filename for the same.

1)CPK_052114_0510_a"_07.pdf
2)CPK_052114_0510_a?_03.pdf
3)CPK_052114_0510_a<_06.pdf
4)CPK_052114_0510_a*_02.pdf
Nov 13, 2014 at 6:06 AM
Hi.

Thank you.
I'll check these file name list to solve your problem.
Nov 20, 2014 at 7:18 AM
Hello Higty,

Have you checked file name's which i had given it to you.

Let me know in any case if you need addition information.
Dec 1, 2014 at 1:07 AM
Hi.

I tried anything and everything.
But I could not reproduct what you say.
Content-Type: Image/png;
    charset="iso-2022-jp";
    Name="CPK_052114_0510_a"_07.pdf";
Content-Disposition: attachment;
    FileName="CPK_052114_0510_a"_07.pdf";
Content-Transfer-Encoding: Base64
I tested above data and show on console.
CPK_052114_0510_a"_07.pdf

Is there any other information?
Dec 8, 2014 at 7:29 AM
Hi higty,

As we were using old version of Higlabo.Issue related to file name CPK_052114_0510_a"_07.pdf has got solved but still one special character ";"(Semicolon)
issue is still there if we use file name like "Test123;12.pdf" it gives us name like "Test123" .
please gives us solution related to this issue.