Quantcast
Channel: imapx Discussions Rss Feed
Viewing all 1144 articles
Browse latest View live

New Post: Announcment: ImapX 2.0.0.17

$
0
0
Hi guys,

the updated nuget package is published.

Greets,

Pavel

New Post: ImapX 2.0.0.18

$
0
0
Hello everyone,

Unluckily the version 2.0.0.17 had a bug in the idle functionality which had a lot of side effects. This bug is fixed now, thanks to everyone who helped discovering it! Version 2.0.0.18 is out now, you can download it in the downloads section or using nuget.

Best regards,

Pavel

New Post: How to use IMAPx with STARTTLS

$
0
0
I have seen several people ask about STARTTLS, but not sure how to implement the code they referenced. Is STARTTLS natively supported in IMAPX? If so, could someone please provide some sample code? I am connecting to Exchange servers and they require STARTTLS.

New Post: How to use IMAPx with STARTTLS

$
0
0
Hi ryanfarquhar,

I will make an update and post some sample code later today.

Greets,

Pavel

New Post: Mail message attachment problems

$
0
0
I have a problem where I download a message with a file attached and the attachment is missing from the attachments list.

The file also has a email signature image which is listed in the EmbeddedResources array but when I save the email signature image, it has the data of the missing file attachment!

Any ideas anyone?

New Post: Attachments not showing in Message

$
0
0
Hi,

I have one email with one file attachment and body contains signature. When I am read email by ImapX I can't getting file attachment.

When Email contains Attachments and EmbeddedResources (like signature in body part) in this case email message only showing EmbeddedResources but not showing Attachments.

I am using "ImapX 2.0.0.18 Binaries\v3.5\ImapX.dll" in Visual Studio 2010.

Is there any Solution for above issue?

New Post: "Expression Times Out" Error when looping through messages

$
0
0
This is the code I'm using in vb.net to connect to a gmail account and display emails
The problem is that when I get to my for loop, myinbox.messages gives me an error myinbox.messages: "Evaluation of expression or statement timed out."
and it wont loop through the messages unless I debug it and refresh
     client = New ImapX.ImapClient("imap.gmail.com", True)
    client.Connect()
    client.Login("Email", "Password")
    client.Behavior.NoopIssueTimeout = 120
    client.Behavior.AutoPopulateFolderMessages = True
    Try
           dim  myinbox = client.Folders.inbox           
        For Each Message In myinbox.messages
             'save them into an array
        Next

New Post: "Expression Times Out" Error when looping through messages

$
0
0
Hi DMandy,

I expect you see this exception when trying to see the values in the watch window during debug time. This happens because the messages are being downloaded at same time as you try to access the collection. This takes time, so the evaluation will time out. You can call the Download method on the Messages collection first to download the messages, before you iterate through the collection.

Greets,

Pavel

New Post: UWP version

$
0
0
Hi,

there is a plan for release a UWP version of this library?

Thank for your hard work!!

New Post: "Expression Times Out" Error when looping through messages

$
0
0
How long should it take for the messages to download?
The code just sits there for five minutes doing nothing and then bugs out with a
"ContextSwitchDeadlock was detected" ERROR

New Post: unable to download Yahoo mail attachments.

$
0
0
If i try to download "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." i got this error

New Post: Gmail Attachments in v2.0.0.18 versus v2.0.0.16

$
0
0
Hi,
I was using v2.0.0.16 and could successfully read attachments from my gmail account (but not the body text - I was getting IMAPX55 NO Some messages could not be FETCHed (Failure))

So I upgraded to v2.0.0.18 to see if that would fix the body text problem. It did fix it - however now I'm getting 0 attachments !!

I downgraded to 2.0.0.16 and attachments started working again and the body text error came back

note: I've been testing with the exact same email in Gmail for all my tests

Any ideas what broke in 2.0.0.18 with attachments?

Thanks for your help

New Post: If i have above 5000 mails. I am Unable to read the mails

$
0
0
If i have above 5000 mails. I am Unable to read the mails

New Post: Extended error message on Imapbase.Connect

$
0
0
Hi all,

I had some trouble connecting the imap server in our environment. This was not a problem of imapX, but the ImapClient.Connect method does not return any inner error message.
So my suggestion is to give ImapBase.Connect an additionally parameter (bool throwExceptionOnError = false) so the caller can decide if he wants the full exception if something goes wrong.
/// <summary>
///     Connects to an IMAP server on the specified port
/// </summary>
/// <param name="host">Server address</param>
/// <param name="port">Server port</param>
/// <param name="sslProtocol">SSL protocol to use, <code>SslProtocols.None</code> by default</param>
/// <param name="validateServerCertificate">Defines whether the server certificate should be validated when SSL is used</param>
/// <param name="throwExceptionOnError">Rethrows the exception in case of problems. This helps to analyze connections problems</param>
/// <returns><code>true</code> if the connection was successful</returns>
/// <exception cref="Exceptions.InvalidStateException">If the client is already connected.</exception>
public bool Connect(string host, int port, SslProtocols sslProtocol = SslProtocols.None,
    bool validateServerCertificate = true, bool throwExceptionOnError = false)
{
    _host = host;
    _port = port;
    _sslProtocol = sslProtocol;
    _validateServerCertificate = validateServerCertificate;

    if (IsConnected)
        throw new InvalidStateException("The client is already connected. Please disconnect first.");

    try
    {
#if !WINDOWS_PHONE && !NETFX_CORE
        _client = new TcpClient(_host, _port);

        if (_sslProtocol == SslProtocols.None)
        {
            _ioStream = _client.GetStream();
            _streamReader = new StreamReader(_ioStream);
        }
        else
        {
            _ioStream = new SslStream(_client.GetStream(), false, CertificateValidationCallback, null);
            (_ioStream as SslStream).AuthenticateAsClient(_host, null, _sslProtocol, false);
            _streamReader = new StreamReader(_ioStream);
        }
#else
//TODO: Add support for Tls
        _client = _sslProtocol == SslProtocols.None ? new TcpClient(_host, _port) : new SecureTcpClient(_host, _port);
        _ioStream = _client.GetStream();
        _streamReader = new StreamReader(_ioStream);
#endif

        string result = _streamReader.ReadLine();

        _lastActivity = DateTime.Now;

        if (result != null && result.StartsWith(ResponseType.ServerOk))
        {
            Capability();
            return true;
        }
        else if (result != null && result.StartsWith(ResponseType.ServerPreAuth))
        {
            IsAuthenticated = true;
            Capability();
            return true;
        }
        else
            return false;
    }
    catch (Exception)
    {
        if (throwExceptionOnError)
            throw;
        return false;
    }
    finally
    {
        if (!IsConnected)
            CleanUp();
    }
}
Regards

Joerg

New Post: c# read an email with a specific subject from gmail and retrieve txt attachment using imap or pop3

$
0
0
Hi All

I have tried using an earlier version of IMAP and don't seem to be winning. I am using the following code behind a button.
I have set the account I am using for 'less secure' and am able to successfully login, but after that things just hang.
I am very new to C# and still have to figure out how to see some debugging info in a messagebox or text box.
//using ImapX_1.2.3.126.zip reference to .dll
            ImapX.ImapClient client = new ImapX.ImapClient("imap.gmail.com", 993, true);
            bool result = client.Connection();
            if (result)
            {
                result = client.LogIn("test_account@gmail.com", "password");
                if (result)
                {
                    textBox1.AppendText(Environment.NewLine + Environment.NewLine + "Log-on successful" +
                        Environment.NewLine + Environment.NewLine);
                    ImapX.FolderCollection folders = client.Folders;
                    foreach (ImapX.Message m in client.Folders["INBOX"].Messages)
                    {
                        m.Process();

                        //if (m.Subject == "test email with 3 attachments (txt, png, wav)")
                        if (m.Subject == "test email")
                        {
                            textBox1.AppendText(Environment.NewLine + Environment.NewLine + "Found email in question..." +
                                Environment.NewLine + Environment.NewLine);
                            string path = Application.StartupPath + "\\email\\";
                            string filename = "test.txt";
                            //comment-out following line if you don't want to d/l the actual email
                            m.SaveAsEmlToFile(path, filename);
                            //use above line, and comment out the following if(){}, if you prefer to download the whole 
                            //email in .eml format
                            if (m.Attachments.Count > 0)
                            {
                                for (int i = 0; i < m.Attachments.Count; i++)
                                {
                                    m.Attachments[i].SaveFile(path);
                                    textBox1.AppendText("Saved attachment #" + (i + 1).ToString());
                                    textBox1.AppendText(Environment.NewLine + Environment.NewLine);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                textBox1.AppendText("connection failed");
            }
First of all, Please forgive the newbie request here.
Will I be able to do the same with the latest version or will I have to alter my code ?

I wonder if someone would be so kind as to provide a specific example of using IMAPX which shows how to c# read an email with a specific subject from gmail and retrieve txt and save the attachment to file and then delete the email.

Kind regards
Den

New Post: How to delete duplicate messages??

$
0
0
Could someone guide me with a little bit of starter code on how I can delete duplicate emails from a folder? I've read that each message has a unique identifier in it, so I figure I need to loop over all the message in a folder, maybe store the message id to an array or list or dictionary if it is not already present in there, and delete the message if it is already in there.

New Post: How to delete duplicate messages??

$
0
0
Ok, I think I have discovered how to do this, but I need access to the Message-ID string value of each email in the target folder. However, I cannot find where the read this value from the Message object.

The only way I see to do this is to call the DownloadRawMessage() method and then parse out the Message-ID value from the full email message as the string returned by this method call.

So, is there a simpler way to access the Message-ID string?

New Post: How to read the Message-ID property from an email?

$
0
0
I need access to the Message-ID string value of each email in a target folder. I read this info is on in the message headers of all emails, however, I cannot find where the read this value from the Message object of this library.

The only way I see to do this is to call the DownloadRawMessage() method and then parse out the Message-ID value from the full email message as the string returned by this method call.

So, is there a simpler way to access the Message-ID string?

New Post: How to delete duplicate messages??

$
0
0
I'm not sure how to do it with ImapX, but the IMAP protocol allows you to FETCH the ENVELOPE of a message, which is essentially a pre-parsed set of the most important headers of a message (including the Message-ID).

That said, a Message-ID is not guaranteed to be unique, so blindly deleting messages with identical Message-IDs is dangerous.

New Post: How to use the folder.Search() method?

$
0
0
Can you give us some examples of how to use the Search() method to get a filtered list of messages?

I'm mostly interested in pulling down messages by a date range, like
  • ReceivedDate => 2015-01-01 and ReceivedDate <= 2015-01-31
or by a string match on the subject:
  • subject.Contains("Blah")
or on the from field:
Is this kind of filtering possible?
Viewing all 1144 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>