InBound Email Creation - Imap Options

Had a problem (major problem) creating an imap-based non-ssl inbound email account -. I need this to start testing the email marketing function. I had previous had trouble, but did not think much of it, since I did not need at the time and was just sending out invoiced via the system smtp account.

Anyways, here goes for those who follow after me:

This functionality occurs in the Email Module | Settings | Create Mail Accounts

  1. After provided the correct Imap parameters for the account I’d get an error stack trace. I then verified my setting were correct in my Thunderbird email client. Standard imap ports with no-ssl or tls - real vanilla account.

  2. Now back to the actual error message which was generated:

Warning: imap_open() [function.imap-open]: Couldn't open stream {}INBOX occurred in /home/techcade/public_html/SuiteCRM/modules/InboundEmail/InboundEmail.php on line 4793 [2013-11-26 17:10:59] display_stack_trace caller, file: /home/techcade/public_html/SuiteCRM/include/utils.php line#: 3251

My imap server did not like the options /secure in the options string (/service=imap/notls/novalidate-cert/secure) to the imap_open() function for my INBOX

This functionality is located in /modules/InboundEmail/InboundEmail.php.

There’s an array nonSsl in InboundEmail.php which the create email account dialog seems to default to the first element ‘both-secure’ regardless of what is entered at the user interface for account creation. (see below)

My fix (unfortunately, non-upgrade-safe) was to redefine both-secure to '/notls/novalidate-cert’ which did the trick.

$nonSsl = array(
						'both-secure'			=> '/notls/novalidate-cert/secure',
  					         'both'				=> '/notls/novalidate-cert',
						'nocert-secure'			=> '/novalidate-cert/secure',
						'nocert'				=> '/novalidate-cert',
						'notls-secure'			=> '/notls/secure',
						'secure'				=> '/secure', // for POP3 servers that force CRAM-MD5
						'notls'					=> '/notls',
						'none'					=> '', // try default nothing

Note: I had the same problem with ssl/tls version of the account and I’m assuming it’s the same problem as the non-ssl case.

Hope this saves some time for others.


Thanks for highlighting and posting your fix.