IMAP Login: BAD Command received in Invalid state.

This error can happen if you connect to an IMAP server without SSL/TLS (i.e. at port 143) but the server does not allow unsecure sessions.  Oddly enough, the Microsoft Exchange IMAP4 server will accept the connection, but will fail any login attempt with this error.  Here is a sample SessionLog:

Connecting to IMAP server at xxxx.com:143
> ----IMAP RESPONSE----
> * OK The Microsoft Exchange IMAP4 service is ready.
> ----IMAP REQUEST----
> aaab LOGIN "mylogin"
> ----IMAP RESPONSE----
> aaab BAD Command received in Invalid state.

The solution is to use port 993 w/ SSL/TLS. Do this by setting the Chilkat.Imap.Port property = 993, and the Chilkat.Imap.Ssl property = True prior to connecting.

Sent Email not Found in Exchange’s “Sent Items” Folder?

Question:

After I send an email using Chilkat, I don’t see the email in the “Sent Items” folder in Exchange. How can this be done? Is it possible?

Answer:

The “Sent Items” folder is specific to Exchange/Outlook — it is not part of the SMTP protocol. You may use Chilkat IMAP to “append” a copy of the sent email to an Exchange folder (assuming the Exchange Server’s IMAP protocol is enabled). You would do this by calling Chilkat IMAP’s AppendMail or AppendMime method after the email has been successfully sent.

Exchange Server – POP3, IMAP, and SMTP

Question:

May I ask if is possible use Chilkat components to connect to MS Exchange 6.5 and higher ?
I am thinking about purchase of MailMan component or other as it is, however I would like read some example in C# for reading emails from Exchange and sending emails via Exchange
after connecting to the specified account domain/logname & password.
May I see some examples somewhere on your site?
May you recommend correct components please ?

Answer:

Exchange Server (including v6.5 and higher) implements the server-side of the POP3, IMAP, and SMTP protocols.  Therefore, any software that implements the client-side of these protocols will work with Exchange Server in exactly the same way as any other email server. (See the note below regarding NTLM authentication.)

The purpose of a protocol is to allow any client-side implementation to communicate with any server-side implementation.  As long as each side correctly implements the protocol to specification, everything works.  For example, a web browser implements the client-side of the HTTP protocol.  You may not realize it, but it communicates with many different web server implementations: IIS, Apache, etc.  You can browse the web because the both clients (i.e. web browsers) and servers correctly implement the HTTP protocol.

Therefore, all of the examples involving POP3, SMTP, and IMAP at http://www.example-code.com are examples that will work with Exchange Server.

The Chilkat Email license ($99 for a 1-Developer license) is what you would need for the POP3 and SMTP functionality.  The Chilkat IMAP license ($199 for a 1-Developer license) includes all three: POP3, SMTP, and IMAP.  Note: 1-Developer does not mean “1-Computer”.  It simply means that one person may develop programs using the component.  All Chilkat licenses allow for royalty-free redistribution, meaning you may use the component/library on any number of computers.

*** MS Exchange implements an additional authentication mechanism called “NTLM”, which is also known as Windows Integrated Authentication.   Chilkat supports NTLM for POP3, IMAP, and SMTP.

Ms-Exch-SMTP-Submit Permissions problem seems like invalid login/password

This just came to our attention. When sending email using Exchange Server, a Ms-Exch-SMTP-Submit Permissions problem seems like an incorrect login/password error. A sample of the Chilkat.MailMan’s LastErrorXml is shown below. To get more information, Google “Ms-Exch-SMTP-Submit permission”…

<ChilkatLog>
<SendEmail>
<DllDate>Mar  6 2009</DllDate>
<UnlockPrefix>anything for 30-day trial</UnlockPrefix>
<Username>***</Username>
<Component>Java</Component>
<Recipients>
<NumTo>1</NumTo>
<To>***</To>
<NumCC>0</NumCC>
<NumBCC>0</NumBCC>
</Recipients>
<info>Need new SMTP connection</info>
<SMTP_Connect>
<info>Connecting to SMTP server smtp.***.net:25</info>
<smtp_host>smtp.***.net</smtp_host>
<smtp_port>25</smtp_port>
<smtp_user>***</smtp_user>
<InitialResponse><![CDATA[220 smtp.***.net Microsoft ESMTP MAIL Service ready at Thu, 12 Mar 2009 10:33:32 -0700
]]></InitialResponse>
<info>Sending STARTTLS (1)...</info>
<info>Received 503 SMTP Status...</info>
<info>Resending STARTTLS...</info>
<info>SSL Server Certificate verified.</info>
<ConnectionInfo>
<protocol>TLS1</protocol>
<cipher>ARC4</cipher>
<cipherStrength>128</cipherStrength>
<hash>MD5</hash>
<hashStrength>128</hashStrength>
<keyExchange>RSA</keyExchange>
<keyExchangeStrength>1024</keyExchangeStrength>
</ConnectionInfo>
<info>Secure Channel Established.</info>
<info>TLS connection established.</info>
<sendingHello><![CDATA[EHLO ***
]]></sendingHello>
<helloResponse><![CDATA[250-smtp.***.net Hello [111.111.111.111]
250-SIZE 52428800
250-PIPELINING
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN
250-8BITMIME
250-BINARYMIME
250 CHUNKING
]]></helloResponse>
<login_method>LOGIN</login_method>
<error>535 5.7.3 Authentication unsuccessful</error>
<error>Failed to get response to login password</error>
<info><![CDATA[220 smtp.***.net Microsoft ESMTP MAIL Service ready at Thu, 12 Mar 2009 10:33:32 -0700
503 5.5.2 Send hello first
250-smtp.***.net Hello [111.111.111.111]
250-SIZE 52428800
250-PIPELINING
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-AUTH
250-8BITMIME
250-BINARYMIME
250 CHUNKING
220 2.0.0 SMTP server ready
250-smtp.***.net Hello [111.111.111.111]
250-SIZE 52428800
250-PIPELINING
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN
250-8BITMIME
250-BINARYMIME
250 CHUNKING
AUTH LOGIN
334 AAAAAAAAAAAA
334 BBBBBBBBBBBB
535 5.7.3 Authentication unsuccessful
]]></info>
<info>Failed to login using LOGIN method</info>
</SMTP_Connect>
<error>Failed to connect to SMTP server.</error>
</SendEmail>
</ChilkatLog>

Exchange Server Unencrypted Login/Password w/ POP3

Question:
We are currently using Chilkat to retrieve e-mail for a number of our applications.

A client of ours has updated their exchange mail server and they have disabled the pop3 service because of authentication issues (the user/password is sent unencrypted and would be a threat). Are there any other possibilities within the scope of chilkat to retrieve mail from an Exchange Server without these drawbacks?

Answer:
Your client may enable POP3 w/ SSL/TLS on the Exchange Server. POP3 over SSL/TLS is secure and the password is passed over a TLS encrypted channel. The standard port for POP3 over SSL/TLS is 995, and Chilkat fully supports it.

Outlook vs. Mail Servers

Question:

I am using your email ActiveX control and wanted to know if there is a way to update MS Outlook in the sent folder with the email I am sending with your control?

Answer:

Email clients communicate with email servers using a well-known protocol. Email clients do not generally communicate with other email clients. Here is a non-exhaustive list of email clients, servers, and protocols:

Email Protocols

  • IMAP (for reading email. Email and folders managed on server.)
  • POP3 (for reading email. No folders on server, email generally downloaded and managed locally.)
  • SMTP (for sending email)
  • MAPI (proprietary to Microsoft)

Email Clients and the protocols spoken

  • Microsoft Outlook (POP3, IMAP, SMTP, MAPI)
  • Mozilla Thunderbird (POP3, IMAP, SMTP)
  • Eudora (POP3, IMAP, SMTP)
  • Chilkat Email Component (POP3, SMTP)
  • Chilkat IMAP Component (IMAP)

Email Servers (and the protocols spoken)

  • Exchange Server – speaks POP3, IMAP, SMTP, MAPI
  • MailEnable – speaks POP3, IMAP, SMTP
  • IMail Server – speaks POP3, IMAP, SMTP

Email clients speak the client-side of a protocol.
Email servers speak the server-side of a protocol.

Email clients do not speak to other email clients.
Email client applications keep a local “database” of some sort (file-based or RDB-based) of email accounts, sent-email, and (for POP3) email organized in folders.
Email client components (such as Chilkat) provide the ability to communicate with email servers. The persistence of emails locally is generally left to the application.

Client-to-Server communications with Exchange Server are no different than with any other email server (except if MAPI is used, or if an Exchange-Server specific authentication method is used).

Microsoft Office provides an “Outlook API” to allow applications to communicate with Outlook local stores.

It makes no more sense for Chilkat to communicate with Outlook than it does for Mozilla Thunderbird to communicate with Outlook. (Because client-to-client communications don’t make any sense. Only client-to-server makes sense.)