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>