Giter Club home page Giter Club logo

hpop's People

Contributors

csharptest avatar dereli avatar dsniegocki avatar foens avatar ilyagerasimets avatar joshkeegan avatar rudolfgrauberger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hpop's Issues

Seemingly Undocumented Error Exception

I was originally going to send this to the hpop-users list but saw that bugs should be submitted on github.

I'm in the process of developing a wrapper for the OpenPop DLL using PowerShell, and I've come across a seemingly undocumented error exception:

Exception calling "Connect" with "6" argument(s): "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0.
Parameter name: value"
At D:\working\CIT Users\USER\Powershell\Scripts\Ticket Scripts\OpenPop.psm1:292 char:13

  •         $Pop3Client.Connect($Hostname, $Port, $UseSSL, $ReceiveTimeout, $Sen ...
    
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : ArgumentOutOfRangeException
    
    

I was using the following parameters:

$HostName = "subdomain.domain.com"
$Port = 955
$UseSSL = $true
$ReceiveTimeout = 1
$SendTimeout = 0
$CertificateValidator = $null

$Pop3Client.Connect($Hostname, $Port, $UseSSL, $ReceiveTimeout, $SendTimeout, $CertificateValidator)

Noting the error, I opted to construct a [System.Threading.Timeout.Infinite] variable:

$SendTimeout = [Threading.Timeout]::Infinite

And passed that value into the .Connect() method. This also did not work. I received:

Exception calling "Connect" with "6" argument(s): "Specified argument was out of the range of valid values.
Parameter name: sendTimeout"
At D:\working\CIT Users\USER\Powershell\Scripts\Ticket Scripts\OpenPop.psm1:301 char:13

  •         $Pop3Client.Connect($Hostname, $Port, $UseSSL, $ReceiveTimeout, $Sen ...
    
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : ArgumentOutOfRangeException
    
    

Other Information:
Win 7 SP1
PowerShell 3.0
Signed (strong name) OpenPop.dll 2.0.5 | TimeStamp 5/17/2013 2:03PM | 68KB

Any insight would be most appreciated. I can provide more information as needed.

Control characters in message returned from server

It can happen that messages returned by the server start with control characters (non-printable characters) but after those control characters comes a valid message (starting with a '+') from the server. Those control characters should not be taken into account when checking a message for validity.

We get this on a very regular basis and getting an exception each time is very annoying. We handle exceptions by logging them and the log file gets swamped by the exceptions that are being thrown because of this.

The utility method ReadLineAsBytes in StreamUtility.cs should also include a check for control characters in the following piece of code.

// Do not write \r or \n
if (readChar != '\r' && readChar != '\n')
	memoryStream.WriteByte((byte)justRead);

It only needs to be altered as follows.

// Do not write \r or \n
if (readChar != '\r' && readChar != '\n' && !char.IsControl(readChar))
	memoryStream.WriteByte((byte)justRead);

Error Unknown parameter

Hi

I get the following Error

Unknown parameter in Content-Disposition. Ask developer to fix! Parameter: MODIFICATION-DATE-PARM

in Pop3Client.GetMessage

Regards

Media type invalid

I got a "Media type invalid" exception with version 2.0.6.2 reading following raw message.
Any advice?

Return-path: [email protected]
Delivery-date: Wed, 03 Feb 2016 06:03:12 +0100
Received: from mi010.mc1.hosteurope.de ([80.237.138.245])
by wp141.webpack.hosteurope.de running ExIM with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
id 1aQpay-0002Zd-F4; Wed, 03 Feb 2016 06:03:12 +0100
Received: from blank01.alyon.org ([195.68.40.241])
by mx0.webpack.hosteurope.de (mi010.mc1.hosteurope.de) with esmtp
id 1aQpay-0007qy-1c
for [email protected]; Wed, 03 Feb 2016 06:03:12 +0100
Received: by blank01.alyon.org (Postfix, from userid 0)
id 7A9773A00A6; Wed, 3 Feb 2016 06:02:25 +0100 (CET)
To: [email protected]
Subject: CEAPR, informations BS / LS & Publications
X-PHP-Originating-Script: 1017:envoie-mail-bs.php
From: "C.E.A.P.R." [email protected]
Reply-To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="_----------=_parties_793810cefcf23eb51e6bda2c64d1b571"
Message-Id: [email protected]
Date: Wed, 3 Feb 2016 06:02:25 +0100 (CET)
X-HE-Virus-Scanned: Yes
X-HE-Spam-Level: /
X-HE-Spam-Score: 0.1
X-HE-Spam-Report: Content analysis details: (0.1 points)
pts rule name description


-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no
trust
[195.68.40.241 listed in list.dnswl.org]
0.1 HTML_MESSAGE BODY: HTML included in message
0.0 MISSING_MIME_HB_SEP BODY: Missing blank line between MIME header and
body
Envelope-to: [email protected]

--_----------=_parties_793810cefcf23eb51e6bda2c64d1b571
Content-Type: text/plain
charset="UTF-8"
Content-Transfer-Encoding: 8bit

Bonjour

Un BS/LS SL 990813 - PUBLICATION CATALOGUE a été ajouté sur notre site internet CEAPR, concernant les avions Cap

Pour les consulter, cliquer sur le lien ci-dessous :
BS / LS et Publications CEAPR

CEAPR vous remercie pour votre confiance

Hello

Un BS/LS SL 990813 - PUBLICATION CATALOGUE concerning Cap airplanes has been inserted on our Internet site CEAPR.
To see, click on the following link :
CEAPR SB/SL and Publications

CEAPR thanks you for your confidence.

--_----------=_parties_793810cefcf23eb51e6bda2c64d1b571
Content-Type: text/html; charset="UTF-8"; Content-Transfer-Encoding: 8bit;



<title>C.E.A.P.R.</title>

Un BS/LS SL 990813 - PUBLICATION CATALOGUE a été ajouté sur notre site internet CEAPR, concernant les avions Cap
Pour les consulter, cliquer sur le lien ci-dessous :
BS / LS et Publications CEAPR

CEAPR vous remercie pour votre confiance


Hello

Un BS/LS SL 990813 - PUBLICATION CATALOGUE concerning Cap airplanes has been inserted on our Internet site CEAPR.
To see, click on the following link :
CEAPR SB/SL and Publications

CEAPR thanks you for your confidence.

--_----------=_parties_793810cefcf23eb51e6bda2c64d1b571--

Able to have European characters as password like "é"

Hi there,

would it be easy to add capability like authentication with european characeter like "é", because currently if I have set up a email account that have password with "é" in it, when it comes to the
Pop3Client.Authenticate() method it just give InvalidLoginException.

Connect() does not use tls 1.2 by default for SslStream

Would be nice for Connect() to use tls 1.2 by default or allow for SslProtocols to be passed to sslStream.AuthenticateAsClient().

Workaround is to create SslStream manually and pass to Pop3Client.Connect(Stream):


/// <summary>
        /// Need to manually create Pop3Client.Connect TcpStream to force tls1.2 to be used since not on .net 4.6 yet 
        /// </summary>
        /// <param name="client"></param>
        /// <param name="host"></param>
        /// <param name="port"></param>
        /// <param name="useSsl"></param>
        private void OpenPopConnect(Pop3Client client, string host, int port, bool useSsl, int receiveTimeout, int sendTimeout, RemoteCertificateValidationCallback certificateValidator)
        {
            TcpClient clientSocket = new TcpClient();
            clientSocket.ReceiveTimeout = receiveTimeout;
            clientSocket.SendTimeout = sendTimeout;

            try
            {
                clientSocket.Connect(host, port);
            }
            catch (SocketException e)
            {
                // Close the socket - we are not connected, so no need to close stream underneath
                clientSocket.Close();

                throw new PopServerNotFoundException("Server not found", e);
            }

            Stream stream;
            if (useSsl)
            {
                // If we want to use SSL, open a new SSLStream on top of the open TCP stream.
                // We also want to close the TCP stream when the SSL stream is closed
                // If a validator was passed to us, use it.
                SslStream sslStream;
                if (certificateValidator == null)
                {
                    sslStream = new SslStream(clientSocket.GetStream(), false);
                }
                else
                {
                    sslStream = new SslStream(clientSocket.GetStream(), false, certificateValidator);
                }
                sslStream.ReadTimeout = receiveTimeout;
                sslStream.WriteTimeout = sendTimeout;

                // Authenticate the server
                sslStream.AuthenticateAsClient(host, null, System.Security.Authentication.SslProtocols.Tls12, true);

                stream = sslStream;
            }
            else
            {
                // If we do not want to use SSL, use plain TCP
                stream = clientSocket.GetStream();
            }

            // Now do the connect with the same stream being used to read and write to
            client.Connect(stream);
        }

Fail on try use parsingErrorHandler

Dear,

The parsingErrorHandler is ignored when pass by parameter on GetMessage method.

Please alter the sourcecode MessagePart.cs on static method MessagePart
pass the variable , IParsingErrorHandler parsingErrorHandler = null and alter your call.

like a this:
image

ArgumentException: Invalid DateTime format

This is an error I get fairly often, caused by a date in the header of the email not being in a recognised format.
I assume this format isn't RFC compliant so it's the sending client that's at fault here, but i'd like to be able to work with the message regardless.
If you don't want to add in specific date formats such as this, it would be nice if you could pass some custom date formats to OpenPOP before downloading messages from the server.

System.ArgumentException: Could not parse date: String was not recognized as a valid DateTime.. Input was: "Mon, 18 08 2014 02:08:47" ---> System.FormatException: String was not recognized as a valid DateTime.
   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.Convert.ToDateTime(String value, IFormatProvider provider)
   at OpenPop.Mime.Decode.Rfc2822DateTime.ExtractDateTime(String dateInput)
   at OpenPop.Mime.Decode.Rfc2822DateTime.StringToDate(String inputDate)
   --- End of inner exception stack trace ---
   at OpenPop.Mime.Decode.Rfc2822DateTime.StringToDate(String inputDate)
   at OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue)
   at OpenPop.Mime.Header.MessageHeader.ParseHeaders(NameValueCollection headers)
   at OpenPop.Mime.Header.MessageHeader..ctor(NameValueCollection headers)
   at OpenPop.Mime.Header.HeaderExtractor.ExtractHeadersAndBody(Byte[] fullRawMessage, MessageHeader& headers, Byte[]& body)
   at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
   at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent)
   at OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber)

As you can see from the exception, the offending date & time is: Mon, 18 08 2014 02:08:47.
The actual date part of it is in the UK format of day followed by month.

Get attachments doesn't work for some cases

Hi guys,

I been working on the last 2 years with the open pop 3 library, very good lib by the way – but now I saw an issue that in some cases the library it’s not able to detect the subject of an email (returns null), neither the attachments of the same. I can't attach the example b/c the github site doesn't support .MSG files, if you like, I can sent that one to an email account. I just cloned the code on my machine, I will debug it to see if I can find the issue,

Regards,

Raúl.

System.FormatException in System.Net.Mime.ContentType.set_MediaType( "Content-Transfer-Encoding: 8bit")

System.FormatException: The specified content type is invalid.
in System.Net.Mime.ContentType.set_MediaType(String value)
in OpenPop.Mime.Header.HeaderFieldParser.ParseContentType(String headerValue)
in OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue)
in OpenPop.Mime.Header.MessageHeader.ParseHeaders(NameValueCollection headers)
in OpenPop.Mime.Header.HeaderExtractor.ExtractHeadersAndBody(Byte[] fullRawMessage, MessageHeader& headers, Byte[]& body)
in OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody)
in OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
in OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber)

Rawmessage:

Return-Path: <>
Delivered-To: [email protected]
Received: (qmail 9763 invoked by uid 89); 2 Oct 2012 08:16:56 -0000
Received: from unknown (HELO mySmtp.it) (xxx.xxx.xxx.xxx)
by mysmtpdomain.it with SMTP; 2 Oct 2012 08:16:56 -0000
Received: from mysmtpdomain.it ([xxx.xxx.xxx.xxx])
by mysmtpdomain.it with bizsmtp
id 68EM1k05D4zqQwW018Gwjd; Tue, 02 Oct 2012 10:16:56 +0200
Date: Tue, 02 Oct 2012 10:16:56 +0200
From: Mail Delivery System [email protected]
To: [email protected]
Subject: Delivery status notification
MIME-Version: 1.0
Content-Type: multipart/report;
boundary="------------I305M09060309060P_940813491658160"
X-Spam-Rating: mxavas4.ad.mysmtp.it 1.6.2 0/1000/N
X-Antivirus: AVG for E-mail 2013.0.3426 [3629/6880]
X-AVG-ID: ID27CD4F68-673CDD3B

This is a multi-part message in MIME format.

--------------I305M09060309060P_940813491658160
Content-Type: text/plain; charset=UTF-8;
Content-Transfer-Encoding: 8bit

  This is an automatically generated Delivery Status Notification.      

Delivery to the following recipients was aborted after 0 second(s):

--------------I305M09060309060P_940813491658160
Content-Type: message/delivery-status; charset=UTF-8;
Content-Transfer-Encoding: 8bit

Reporting-MTA: dns; mySmtpDomain.it [xxx.xxx.xxx.xxx]
Received-From-MTA: dns; myHost.myDomain.it [xxx.xxx.xxx.xxx]
Arrival-Date: Tue, 02 Oct 2012 10:16:56 +0200

Final-recipient: rfc822; [email protected]
Action: failed
Status: 5.1.1
Diagnostic-Code: smtp; 553 5.1.1 sorry, no mailbox here by that name.
Last-attempt-Date: Tue, 02 Oct 2012 10:16:56 +0200

--------------I305M09060309060P_940813491658160
Content-Type: text/rfc822-headers; Content-Transfer-Encoding: 8bit
Content-Disposition: attachment

X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9
Date: Tue, 02 Oct 2012 10:16:29 +0200
To: [email protected],[email protected]
From: ME [email protected]
Subject: xxxxxxxxxxxxxxxxxxxxxxxxx
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="=====================888953554=="

--------------I305M09060309060P_940813491658160--

Exception reading message

Hi, i'm getting this error:
System.ArgumentException: Nome di codifica 'ISO8859-15' non supportato.
Nome parametro: name
in System.Globalization.EncodingTable.internalGetCodePageFromName(String name)
in System.Globalization.EncodingTable.GetCodePageFromName(String name)
in OpenPop.Mime.Decode.EncodingFinder.FindEncoding(String characterSet)
in OpenPop.Mime.MessagePart.ParseBodyEncoding(String characterSet)
in OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers)
in OpenPop.Mime.MessagePart.GetMessagePart(Byte[] rawMessageContent)
in OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody)
in OpenPop.Mime.MessagePart.ParseBody(Byte[] rawBody)
in OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers)
in OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
in OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber)

using GetMessage method
This happens on a specific message, on other messages works successfully.
Now i bypass this message with try catch to avoid blocking email pop but i cannot read the indicted message.

Protect System.Net.Mail.MailMessage.Subject property assaignemnt from throwing an exception

When I was downloading around 15000 messages from gmail at one point I got this exception

Unhandled Exception: System.ArgumentException: The specified string is not in the form required for a subject.
   at System.Net.Mail.Message.set_Subject(String value)
   at OpenPop.Mime.Message.ToMailMessage()

Unfortunately, I cannot recreate that error. This is what I found on stack overflow
http://stackoverflow.com/questions/7239733/resolving-the-specified-string-is-not-in-the-form-required-for-a-subject

Problem fetching receivers from To:

Hi!

There might be issue with reading receivers when email has divided receivers in header on this way:

To:[email protected]
To:[email protected]
Subject: 4315 - 38559166
Message-ID: 38559166.252.401689262
X-Mailer: WWMS
MIME-Version: 1.0

I had tested on two different email servers. On of then has header like this one above, and another has
like this:

To: [email protected], [email protected]

In example above OpenPOP decodes receivers correct but on first example reads only second receiver.

Update message list

Hello,

Once a connection is established and authenticated, is it possible to "refresh" so that I can see whether any new emails were sent to the inbox without having to recreate a new OpenPOP object and connect and authenticate again?

Reading the attachment filename fails with 2.0.4.369

Excerpt of the original raw content:

Content-Type: application/pdf; name=
    "veryloooooongfilename.pdf"
Content-Description: veryloooooongfilename.pdf
Content-Disposition: attachment; filename=
    "veryloooooongfilename.pdf";
    size=192136; creation-date="Tue, 08 Apr 2014 13:57:57 GMT";
    modification-date="Tue, 08 Apr 2014 13:57:57 GMT"
Content-Transfer-Encoding: base64

Gives me \t"veryloooooongfilename.pdf" as fileName instead of veryloooooongfilename.pdf

Decode base64 bug

String
=?utf-8?B?0JTQuNGB0LvQvtC60LDRhtC40Y8g0YHQu9C10LTRg9GO0YnQ?= =?utf-8?B?uNGFINCyINCw0LTRgNC10YEg0JLQodCaINC60L7QvdGC0LXQudC90LXR?= =?utf-8?B?gNC+0LIu?=

must be decoded as

=?utf-8?B?0JTQuNGB0LvQvtC60LDRhtC40Y8g0YHQu9C10LTRg9GO0YnQuNGFINCyINCw0LTRgNC10YEg0JLQodCaINC60L7QvdGC0LXQudC90LXRgNC+0LIu

Not separated.
EncodedWord.cs (48)

Attachment found with "FileName" property set to "(no name)"

Hi,

When sending email to email address that doesn't exist (e.g. [email protected]), Office 365 can automatically reply with undeliverable email ("Your message to [email protected] couldn't be delivered...")

When processing that mail, method "FindAllAttachments" in class "Message" finds attachment with "ContentType" set to "message/rfc822" and "FileName" property set to "(no name)". "ContentType" and "ContentDisposition" header properties don't contain file name information. Can this be fixed so that "FileName" property is set correctly with file name and extension?

With thanks,
Filip

Base64 reading issue

There is an exception "Invalid length for a Base-64 char array." when reading base64-encoded message parts which contain non-base64 characters, for example leading spaces in each line of encoded part.

Standard rfc2045, section 6.8 says:

Any characters outside of the base64 alphabet are to be ignored in
base64-encoded data.

and

In base64 data, characters other than those in Table 1, line breaks, and other
white space probably indicate a transmission error, about which a
warning message or even a message rejection might be appropriate
under some circumstances.

Spaces are outside of the base64 alphabet and fall to white space category so they don't indicate transmission error and should be ignored.

Please, consider adding more filtering on base64-encoding part before submitting it to System.Security.Cryptography.FromBase64Transform.

An example message, which triggers the exception, could be provided.

not works for gmail, what should do for?

Pop3Client pop3Client = new Pop3Client();
try
{
pop3Client.Connect("pop.gmail.com", 995, true);
pop3Client.Authenticate("email", "password");
pop3Client.Disconnect();
return true;
}
catch (OpenPop.Pop3.Exceptions.InvalidLoginException ex)
{
MessageBox.Show(ex.Message + "\nPlease take a look at "Email" and "Password" fields, verify if both are correct.");
return false;
}

i tried for microsoft hotmail and works perfectly, but for gmail give me exception "Server did not accept user credentials", but the credentials are correct, i logged manually on browser to see if is correct.
what should i do?

Email "To:" Aliases unavailable/missing

The "To" header list and UnknownHeaders list both seem to not capture the email alias used for inbound email being retrieved via Pop. The "To" list resolves to the base/actual email address only (ignoring what is otherwise in the headers originally).

Base-64 字符数组或字符串的长度无效。

在 System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
在 System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
在 System.Convert.FromBase64CharArray(Char[] inArray, Int32 offset, Int32 length)
在 System.Security.Cryptography.FromBase64Transform.TransformBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 outputOffset)
在 OpenPop.Mime.Decode.Base64.Decode(String base64Encoded) 位置 e:\Solution\OA\Code\OpenPop.NET 2.0.5\source\OpenPop\Mime\Decode\Base64.cs:行号 44
-----以下为待解码的字符串-------------------------------------------------------------------------------
5ZCE5L2N6Kaq5oSb55qERkMy55So5oi277yaDQoNCuWkp+WutuWlve+8gemdnuW4uOaEn+isneaCqOS4gOebtOS7peS+huWwjUZDMueahOS9v+eUqOiIh+aUr+aMge+8gQ0K5Zyo5q2k5bCH54K65oKo5o+Q5L6bRkMy5YCL5pyN5YuZ55qE5pyA5paw6KiK5oGv44CCDQoNCuWFp+WuueaRmOimge+8mg0KDQoxLkZDMuaLjeaJi+WFqOaWsOWkp+aUueeJiO+8ge+8iOWujOWFqOWFjeiyu++8ge+8iQ0KMi7mgqjmraPlnKjkvb/nlKjmiJbmraPmupblgpnkvb/nlKhGQzLoqIjmlbjlmajll47vvJ8NCjMu5ZyoVHdpdHRlcuOAgVBsdXJr5oiW5YW25LuW5b6u57ay6KqM5LiK5YiG5LqrRkMy5L2/55So5b+D5oOF77yBDQoNCg0KKioqKiAxLiBGQzLmi43miYvlhajmlrDlpKfmlLnniYjvvIHvvIjlrozlhajlhY3osrvvvIHvvIkqKioqDQoNCuS7gOm6veaYr+KAnEZDMuaLjeaJi+KAne+8nw0KDQpGQzLmi43miYvvvIzmmK/nt4rlr4bpgKPntZDkvoboqKrogIXoiIfpg6jokL3moLzmiJbntrLnq5nkuLvkurrnmoTlsI/lt6XlhbfjgIINCuWPqumcgOWwh+aLjeaJi+aMiemIleewoeWWruioreWumuaWvOaCqOeahOmDqOiQveagvOaIlue2suermeS4reWWnOatoeeahOWcsOaWueWNs+WPr+OAgg0K5L6G6Kiq6ICF5Y+q6ZyA6LyV6ayG6bue6YG477yM5L6/5Y+v6YCB5Ye65bCN6YOo6JC95qC85oiW57ay56uZ55qE6byT5Yu144CCDQoNCuKXi+WbnuemrueVq+mdouS4re+8jOWPr+WwjeS+huioquiAheihqOekuuaEn+isnQ 0KDQrlj6/lnKjlm57npq7nlavpnaLpoa/npLrkvoboqKrogIXmi43miYvmmYLpgIHlh7rnmoTnlZnoqIDvvIwNCuS4puWPr+WwjeWFtumAsuihjOWbnuimhuaIlueZvOmAgeWbnuimhumDteS7tuOAgg0KDQril4vku6XlnJbooajpoa/npLrmi43miYvmlbjlkoznlZnoqIDmlbgNCg0K5Y+v5bCHRkMy5ouN5omL5pW45ZKM55WZ6KiA5pW45oyJ5aSp5oiW5oyJ5bCP5pmC5a+m5pmC6aGv56S654K65ZyW6KGo44CCDQrpg6jokL3moLzkuK3lk6rnr4fmlofnq6DmnIDmnInkurrmsKPkuIDnnIvkvr/nn6XvvIENCg0K4peL5YW25LuW6YKE5pyJ44O744O744O7DQrjg7vmlLbliLDmi43miYvmmYLnmoTpg7Xku7bpgJrnn6Xlip/og70NCuODu+aLjeaJi+aVuOeEoeS4iumZkO+8gQ0K44O755W254S277yM5a6M5YWo5YWN6LK777yBDQoNCuaqouimluips+e0sOWFp+WuueOAgemAsuihjOeZu+WFpeaZgu+8jOiri+m7numBuOatpOmAo+e1kO+8mg0KaHR0cDovL2JpdC5seS9iNjZRc3ANCg0KDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCg0KKioqKiAyLuaCqOato+WcqOS9v+eUqOaIluato+a6luWCmeS9v+eUqEZDMuioiOaVuOWZqOWXju+8nyAqKioqDQoNCuS7gOm6veaYr+KAnEZDMuioiOaVuOWZqOKAne+8nw0KDQpGQzLoqIjmlbjlmajvvIzmmK/lj6/ku6XnsKHllq7ntbHoqIjmgqjnmoTpg6jokL3moLzmiJbntrLnq5nkvoboqKrogIXkurrmlbj nmoTmnI3li5njgIINCkZDMuioiOaVuOWZqOWFt+acieaoo+adv+e5geWkmuOAgeaykuacieW7o+WRiuOAgee1seioiOaVuOWtl+WcluW9oumhr+ekuuOAgemaseiXj+W8j+aXpeabhg0K5Lul5Y+K57Ch57SE5pmC5bCa562J5aSa56iu54m56bue44CC5LiA5a6a5pyD6K6T5oKo5oSb5LiN6YeL5omL77yBDQoNCuaqouimluips+e0sOWFp+Wuue+8jOiri+m7numBuOatpOmAo+e1kO+8mg0KaHR0cDovL2JpdC5seS9iMVJvbEINCg0KDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCg0KKioqKiAzLuWcqFR3aXR0ZXLjgIFQbHVya+aIluWFtuS7luW+rue2suiqjOS4iueZvOihqEZDMuS9v+eUqOW/g+aDhe+8gSAqKioqDQoNCuWmguaenOaCqOacieS9v+eUqFR3aXR0ZXLmiJZQbHVya+etieW+rue2suiqjO+8jOS+huWIhuS6q+S4gOS4i0ZDMuWQhOacjeWLmeeahOS9v+eUqOW/g+aDheWQp++8gQ0K5q+U5aaC77yM5oKo5Y+v5bCH5Zyo5L2/55SoRkMy5pyN5YuZ5pmC6Ka65b6X6YKE5LiN6Yyv55qE44CB6YKE6ZyA5pS56YCy55qE5oiW5q+U6LyD6Zuj5oeC55qE5Zyw5pa55Zyo5b6u57ay6KqM5LiK5ZGK6Ki05aSn5a6244CCDQrlnKhUd2l0dGVy5LiK55m86KGo5pmC77yM6KuL5LiN6KaB5b+Y6KiY5re75YqgICNmYzJycXN0IOWTpu+8geaIluiosUZDMueri+WNs+Wwseacg+ihjOWLle+8gQ0KDQpUd2l0dGVy77yaaHR0cDovL3R3aXR0ZXIuY29t L2ZjMl90dw0KUGx1cmvvvIjlmZfmtarvvInvvJpodHRwOi8vd3d3LnBsdXJrLmNvbS9mYzJfdHcgDQoNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpGQzLku4rlvozlsIfnubznuozlvp7nlKjmiLbnmoTpnIDmsYLlh7rnmbzvvIwNCuS7peaPkOS+m+abtOmrmOWTgeizqueahOacjeWLmeeCuuebruaome+8jOS4jeaHiOWKquWKm++8gQ0KDQoo5q2k6YO15Lu255qE55m86YCB5bCN6LGh54K65L2/55SoRkMy5ZCE5pyN5YuZ55qE55So5oi244CCKQ0KDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NClR3aXR0ZXI6IGh0dHA6Ly90d2l0dGVyLmNvbS9mYzJfdHcNClBsdXJr77yI5ZmX5rWq77yJ77yaaHR0cDovL3d3dy5wbHVyay5jb20vZmMyX3R3IA0KRkMyLEluYy4g77yIaHR0cDovL2ZjMi5jb20v77yJDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0=

System.FormatException thrown when getting certain email messages

Hello, we've been using hpop for years and never had any issue, until recently when we started getting System.FormatException thrown by client.GetMessage(i) as illustrated in the example below:

var client = new Pop3Client();
...
var count = client.GetMessageCount();
for (var i = 1; i <= count; i++)
{
    OpenPop.Mime.Message message = client.GetMessage(i);
    ...
}

Exception: System.FormatException

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

Stacktrace:

at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64CharArray(Char[] inArray, Int32 offset, Int32 length)
at System.Security.Cryptography.FromBase64Transform.TransformBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 outputOffset)
at OpenPop.Mime.Decode.Base64.Decode(String base64Encoded)
at OpenPop.Mime.MessagePart.DecodeBody(Byte[] messageBody, ContentTransferEncoding contentTransferEncoding)
at OpenPop.Mime.MessagePart.ParseBody(Byte[] rawBody)
at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers)
at OpenPop.Mime.MessagePart.GetMessagePart(Byte[] rawMessageContent)
at OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody)
at OpenPop.Mime.MessagePart.ParseBody(Byte[] rawBody)
at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent)
at OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber)
at MyNamespace.PopService.Query(PopQuery query) in c:\Source\project\Net\Email\PopService.cs:line 31

Non permanent fix:

  1. Debug the program and the last email the code can get before it crashes.
  2. Connect to the mailbox (in imap) with Thunderbird and move the bad email to a local forlder, then put it back in the imap inbox.
  3. Run the example code again and it works.

It seems that thunderbird does some sanitising magic!

I'm trying to find which email is causing the issue this time from our mail server and get to the raw .EML file.

Does not retrieve all email

I have used the code provided in examples but I get only emails from before 2015. Since the emails I would be interested in are current this makes this library fairly useless.

2.0.6 Source Code

Is the 2.0.6 source code available ? Where can i get can anyone tell me please

Exceptions are not marked as Serializable

Hi,

I serialize exceptions to a database to be viewed and audited at a later date. However OpenPop's exceptions are not marked as serializable, and thus a SerializationException is thrown instead, for example:

System.Runtime.Serialization.SerializationException: Type 'OpenPop.Pop3.Exceptions.PopServerNotFoundException' in Assembly 'OpenPop, Version=2.0.5.0, Culture=neutral, PublicKeyToken=bebb5741791313cd' is not marked as serializable.

Server stack trace:
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeMessageParts(ArrayList argsToSerialize)
at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage..ctor(IMethodReturnMessage mrm)
at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage.SmuggleIfPossible(IMessage msg)
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

Would you be able to update the code to mark all of OpenPop's Exceptions are serializable please?

Thanks

Base64: (FormatException)

22/08/2014 14:38:55 Base64: (FormatException) Comprimento inválido para uma matriz de caracteres Base-64.
On string: UmVhZGluZXNzIEV2ZW50IHBhcmEgTWFy5286IENvbmhl52EgYSBtb2RlbG8gTWljcm9zb2Z0IGRl IEluZnJhc3RydWN0dXJlIE9wdGltaXphdGlvbg==
22/08/2014 14:39:01 TestForm: Message fetching failed: Comprimento inválido para uma matriz de caracteres Base-64.
Stack trace:
em System.Convert.FromBase64CharArray(Char[] inArray, Int32 offset, Int32 length)
em System.Security.Cryptography.FromBase64Transform.TransformBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 outputOffset)
em OpenPop.Mime.Decode.Base64.Decode(String base64Encoded) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Decode\Base64.cs:linha 61
em OpenPop.Mime.Decode.Base64.Decode(String base64Encoded, Encoding encoding) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Decode\Base64.cs:linha 79
em OpenPop.Mime.Decode.EncodedWord.Decode(String encodedWords) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Decode\EncodedWord.cs:linha 108
em OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Header\MessageHeader.cs:linha 380
em OpenPop.Mime.Header.MessageHeader.ParseHeaders(NameValueCollection headers) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Header\MessageHeader.cs:linha 287
em OpenPop.Mime.Header.MessageHeader..ctor(NameValueCollection headers) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Header\MessageHeader.cs:linha 265
em OpenPop.Mime.Header.HeaderExtractor.ExtractHeadersAndBody(Byte[] fullRawMessage, MessageHeader& headers, Byte[]& body) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Header\HeaderExtractor.cs:linha 70
em OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Message.cs:linha 81
em OpenPop.Mime.Message..ctor(Byte[] rawMessageContent) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Mime\Message.cs:linha 59
em OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber) na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPop\Pop3\Pop3Client.cs:linha 659
em OpenPop.TestApplication.TestForm.ReceiveMails() na C:\Users\moacir.junior\Downloads\OpenPop.NET 2.0.5\source\OpenPOPTest\TestForm.cs:linha 501

Media Type must be in the format type "/" subtype Parameter name: mediaType

Hi.

Your component is great.

I am testing it and I have an Issue I want to share with you.

I am getting the following message with an specific message.

Media Type must be in the format type "/" subtype Parameter name: mediaType at OpenPop.Mime.Header.HeaderFieldParser.cleanMediaType(String mediaType) at OpenPop.Mime.Header.HeaderFieldParser.ParseContentType(String headerValue) at OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue)
I've got the raw message using GetMessageAsBytes and I saw something could be the cause of the trouble.

Content-Type: pdf;

As I know it should be Content-Type: application/pdf;

If you have any suggestion or fix about it, it would be great.

Thanks.

Longinos Castillo Mexico

Date parsing error

I stumble over this exception a few times a day:

System.ArgumentException: Could not parse date: The added or subtracted value results in an un-representable DateTime.
Parameter name: value. Input was: "from 213.30.242.172:51773 by cmpweb05.aul.t-online.de with HTTP/1.1" ---> System.ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.
Parameter name: value
   at System.DateTime.AddTicks(Int64 value)
   at OpenPop.Mime.Decode.Rfc2822DateTime.AdjustTimezone(DateTime dateTime, String dateInput)
   at OpenPop.Mime.Decode.Rfc2822DateTime.StringToDate(String inputDate)
   --- End of inner exception stack trace ---
   at OpenPop.Mime.Decode.Rfc2822DateTime.StringToDate(String inputDate)
   at OpenPop.Mime.Header.Received..ctor(String headerValue)
   at OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue)
   at OpenPop.Mime.Header.MessageHeader.ParseHeaders(NameValueCollection headers)
   at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
[... my stuff ...]

I'm not entirely sure, but I think most of the time it's because of some t-online.de e-mail, so I guess they use some kind of corrupted header format? It's always a similar exception, with an IP-address where the date should be.

Is there anything that can be done on the side of OpenPOP or do I have to continue ignoring these corrupted e-mails? Thanks!

Identify "real" attachments

Is there any way to identify real Attachements vs Embedded Resources (like signature images, etc)?
I have to download only attached files, like XLS, PDF, etc.

Tks!

Exception reading message 2

Hi, i get this error when reading a message:
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, IFormatProvider provider)
at OpenPop.Mime.Decode.EncodingFinder.FindEncoding(String characterSet)
at OpenPop.Mime.MessagePart.ParseBodyEncoding(String characterSet)
at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent)
at OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber)

using GetMessage method
This happens on a specific message, on other messages works successfully.
Now i bypass this message with try catch to avoid blocking email pop but i cannot read the indicted message.

When loading/reading emails from the hard disk it's very slow is there anything to do about it ?

Slow i mean in many cases the hard disk think a lot or the program even stop for some seconds.
This is my code in a backgroundworker dowork event

int countUploadMsg = 0; private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { int counter = 0; allLoadedMessages = new List<OpenPop.Mime.Message>(); OpenPop.Mime.Message loadedMessage = null; DirectoryInfo di = new DirectoryInfo(@"e:\testmail\"); FileInfo[] files = di.GetFiles();//new FileInfo(@"e:\testmail\" + emailNumber + ".eml"); foreach (FileInfo file in files) { loadedMessage = OpenPop.Mime.Message.Load(file); allLoadedMessages.Add(loadedMessage); counter += 1; int nProgress = counter * 100 / files.Length; backgroundWorker2.ReportProgress(nProgress); } }

It's working but get slow in some places while loading/reading the emails from the hard disk.
The files on the hard disk are .eml the biggest are 8.5MB and htere are smaller like 23KB

I saw this problem with someone else here:

http://stackoverflow.com/questions/24364402/how-to-parse-emails-faster-than-openpop-dll

There is explaining there about the problem but the solution is to work with other library and i want to keep working with OpenPop. The question is if there is anything to do with this problem ?

Accented characters from UTF-8 attachments are converted to ??

Steps to reproduce:

Use this code to read UTF-8 encoded attachment:

using (OpenPop.Pop3.Pop3Client client = new Pop3Client())
{
    client.Connect("mail.company.com", 110, false);
    client.Authenticate("user", "pass", AuthenticationMethod.UsernameAndPassword);
    if (client.Connected)
    {
        int messageCount = client.GetMessageCount();
        List<Message> allMessages = new List<Message>(messageCount);
        for (int i = messageCount; i > 0; i--)
        {
            var msg = client.GetMessage(i);
            var att = msg.FindAllAttachments(); 
            foreach (var ado in att)
            {
                var xml = ado.GetBodyAsText();

In result xml string accented characters are converted to tow ?? marks.
XXXLTEC O=C3=9C in message below appears as XXXLTEC O?? in xml variable.
Correct result is XXXLTEC OÜ

Sample XML Attachment in message:

------=_NextPart_000_0066_01D0302C.83D6EFA0
Content-Type: text/xml;
    name="tapitolemas.xml"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
    filename="tapitolemas.xml"

<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<E-Document>
  <Header>
    <DateIssued>2015-01-02T13:27</DateIssued>
    <SenderID>-</SenderID>
    <ReceiverID>1COL</ReceiverID>
  </Header>
  <Document>
    <DocumentType>invoice</DocumentType>
    <DocumentFunction>original</DocumentFunction>
    <DocumentParties>
      <BuyerParty context=3D"partner">
        <PartyCode>1COL</PartyCode>
        <Name>XXXLTEC O=C3=9C</Name>

Posted also in https://stackoverflow.com/questions/27949470/how-to-read-utf-8-mail-attachments-from-pop3

Forward mail

Can we forward mail with attachment to other id using this library.

System.ArgumentException: Unknown parameter in Content-Disposition. Ask developer to fix! Parameter: INLINE BOUNDARY

System.ArgumentException: Unknown parameter in Content-Disposition. Ask developer to fix! Parameter: INLINE BOUNDARY
at OpenPop.Mime.Header.HeaderFieldParser.ParseContentDisposition(String headerValue)
at OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue)
at OpenPop.Mime.Header.MessageHeader.ParseHeaders(NameValueCollection headers)
at OpenPop.Mime.Header.MessageHeader..ctor(NameValueCollection headers)
at OpenPop.Mime.Header.HeaderExtractor.ExtractHeadersAndBody(Byte[] fullRawMessage, MessageHeader& headers, Byte[]& body)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
at OpenPop.Pop3.Pop3Client.GetMessageHeaders(Int32 messageNumber)

exception " 'null' is not supported encoding name" when charset=null

Hello,

We have an application relying on OpenPop to fetch email messages and their attachments on pop connection.

Recently, we had this style of error:

'null' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
Parameter name: name

at System.Globalization.EncodingTable.internalGetCodePageFromName(String name)
at System.Globalization.EncodingTable.GetCodePageFromName(String name)
at System.Text.Encoding.GetEncoding(String name)
at OpenPop.Mime.Decode.EncodingFinder.FindEncoding(String characterSet)
at OpenPop.Mime.MessagePart.ParseBodyEncoding(String characterSet)
at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers)
at OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
at OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber)

My colleague has run OpenPop in debug mode and we have found that the issue seems to come from ParseBodyEncoding function in MessagePart.cs.

To fix this issue we had to modify these lines with:

if (!string.IsNullOrEmpty(characterSet) && charSet.toLower() != "null" )
  encoding = EncodingFinder.FindEncoding(characterSet);

We've found that, because the header of problematic messages contained this type of text:

Content-Type: application/pdf; charset=null;
name="SomePDF.pdf"
Content-Disposition: attachment;
filename="SomePDF.pdf"
Content-Transfer-Encoding: base64

That's a bit of workaround, I think the code could set characterSet to the real null if it detect that the string is equals to the string "null".

Thanks,
Adrien

Incorrect message uids count from GMAIL

Hi

I've some problems using latest version from NuGet.

I'm unable (getMessageUids()) to read all message uids when connected to GMAIL

I'm getting only 297 items but there is much more messages on server.

With other providers it works fine.

System.ArgumentException: '\"iso-8859-1\"' is not a supported encoding name

When retrieving a message via GetMessage, sometimes i got
An exception occured : System.ArgumentException: '"iso-8859-1"' is not a supported encoding name.
Parameter name : name
at System.Globalization.EncodingTable.internalGetCodePageFromName(String name)
at System.Globalization.EncodingTable.GetCodePageFromName(String name)
at OpenPop.Mime.Decode.EncodingFinder.FindEncoding(String characterSet)
at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers, IParsingErrorHandler parsingErrorHandler)
at OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody)
at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers, IParsingErrorHandler parsingErrorHandler)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody, IParsingErrorHandler parsingErrorHandler)
at OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber, IParsingErrorHandler parsingErrorHandler)

How can i solve this ?

Media Type must be in the format type "/" subtype

I received a DMARC report from comcast.net where they attach a file with this headers:

--=swift_v4_1446797115_ca703a3c7df531536614df116b23855b=
Content-Type: application-x-gzip; name=comcast.net![hidden].xml.gz
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename=comcast.net![hidden].xml.gz

The Exception stack is:
Parameter name: mediaType
at OpenPop.Mime.Header.HeaderFieldParser.cleanMediaType(String mediaType)
at OpenPop.Mime.Header.HeaderFieldParser.ParseContentType(String headerValue)
at OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue)
at OpenPop.Mime.Header.MessageHeader.ParseHeaders(NameValueCollection headers)
at OpenPop.Mime.Header.MessageHeader..ctor(NameValueCollection headers)
at OpenPop.Mime.Header.HeaderExtractor.ExtractHeadersAndBody(Byte[] fullRawMessage, MessageHeader& headers, Byte[]& body)
at OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody)
at OpenPop.Mime.MessagePart.ParseBody(Byte[] rawBody)
at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers)
at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody)
at OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber)

Infinite timeout receiveTimeout and sendTimeout not working

When trying to connect using receiveTimeout and sendTimeout using no timeout there is no way to get it working.

TcpClient is used so the infinite timeout is System.Threading.Timeout.Infinite = -1
and OpenPop3.NET is throwing an exception when < 0

if (receiveTimeout < 0)
throw new ArgumentOutOfRangeException("receiveTimeout");
if (sendTimeout < 0)
throw new ArgumentOutOfRangeException("sendTimeout");

OpenPop.Mime.Message.ToMailMessage() attachment name parsing bug

Hi,

I have found a bug when receiving emails from live.com, hotmail.com, windowslive.com, etc. with attachments in it. I'm not sure that the attachment name parsing is wrong on your side, I think it is the error of the mailing system (http://forum.rebex.net/questions/2948/imap-an-attachment-s-filename-is-empty-for-mails-sent-from-hotmail).

I found a quick workaround for that, but I don't want to work with an "unofficial" version of your library. My workaround for OpenPop.Mime.Message.ToMailMessage is to add a null checking logic when you are iterating over the attachments, and if it fails then use the FileName property as a fallback.
In code:

// Add attachments to the message
IEnumerable attachments = FindAllAttachments();
foreach (MessagePart attachmentMessagePart in attachments)
{
MemoryStream stream = new MemoryStream(attachmentMessagePart.Body);
if (string.IsNullOrEmpty(attachmentMessagePart.ContentType.Name))
{
attachmentMessagePart.ContentType.Name = attachmentMessagePart.FileName;
}
Attachment attachment = new Attachment(stream, attachmentMessagePart.ContentType);
attachment.ContentId = attachmentMessagePart.ContentId;
message.Attachments.Add(attachment);
}

Hope this issue helps you guys to make your library more robust. If you have any question, please let me know, I am happy to help.

Imre Fodi,

Version 2.0.6.1120 cannot be referenced in IDE

Hi,

Recently I found OpenPop.Net. It looks it's just I am looking for. I downloaded the version 2.0.6.1120, the assembly said is strong-named (signed). We have an IDE environment which only allows strong-named assembly. I couldn't reference the version 2.0.6.1120 in my IDE window. So I downloaded version 2.0.5 which is also strong-named assembly. The assembly of the version 2.0.5 can be referenced in the IDE. I wonder why version 2.0.6.1120 didn't work like version 2.0.5. Thanks

where is the method 'GetMessageUidsWithNumber'

i use the openpop Version=2.0.2.340
when i invoke Pop3Client.GetMessageUidsWithNumber
i throw exception '[FormatException: 输入字符串的格式不正确。] System.Number.StringToNumber' and so on..

but i can't find this method 'GetMessageUidsWithNumber' in source code.

so what kind of problem will cause this error..??

pls help. online waiting

OpenPop.Mime.Message.ToMailMessage() - Wrong HTML-Body conversion

The ContentType of the System.Net.Mail.MailMessage.Body content is always "text/plain".
https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.body(v=vs.100).aspx

Bug No.1:
In OpenPop.Mime.Message.ToMailMessage() HTML-Bodys are copied into System.Net.Mail.MailMessage.Body

Bug No.2:
In OpenPop.Mime.Message.ToMailMessage() the HTML-Bodys is not copied into the AlternateViews. So when System.Net.Mail.MailMessage.IsBodyHtml is set true a email-client like Outlook can't find the html-part and shows the wrong formated "text/plain" Body.

current.txt
fixed.txt

InvalidLoginException since this morning?

I have a C# app using OpenPop, sending E-Mails through GMAIL.
This app has been working for the last few years, without a problem, and the last EMAIL I got from it was 8 hours ago.
Now I get an 'InvalidLoginException' error when I try to log in. I logged in normally to my account, even tried to change passwords but I still get this same message.
Following previous tips I tried to change the login line from

pop3Client.Authenticate(EMAIL_ADDRESS, ACCOUNT_PASSWORD) to
pop3Client.Authenticate(EMAIL_ADDRESS, ACCOUNT_PASSWORD, AuthenticationMethod.UsernameAndPassword)
But I still get the same message. Anyone knows what could be wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.