Import of e-mail fail...šŸ™€

Tnx anyway! I assume installing the php-auth-sasl is a prerequisite to read mail as well, but am not sure. If so, the next step is to find out what is needed to make sure SuiteCRM uses it. Or find another solution, at this moment I canā€™t use SuiteCRM as I used to do. I am still open for suggestions :slight_smile:

@RichardW Can you have SuiteCRM use PHP 7.4 instead of PHP 8 ?

I tried that, I also read that this might help. Unfortunately, it doesnā€™t. De 7.14(.1) upgrade made it impossible.

Can you revert version 7.13 + php 7.4 ? Until the email import will be fixed for php 8 ?

I used PHP 7.4 but even with that PHP version the login to my EMail Provider in 7.14 does not work. Bacuae i made no backup before the upgrade to SuiteCRM 7.13 I cant revert to that Version.

Dear Chris, i made all this Setting for my Strato Mail Account and checked it multiple times.
But it does not work :frowning:

With a Gmail test Account it works at the first time i used it.

First time suitecrm user. Installing the latest techstack using 8.4.x which requires PHP 8.x.
Iā€™m getting the same error:
Can not authenticate to IMAP server: The Auth_SASL package is required for DIGEST-MD5 authentication
Running postfix/dovecot on ubuntu which works for everything else.
The error sounds like I need to install the Auth_SASL package for SuiteCRM. How do I do that?

Update: when searching for the package, it says:
php-auth-sasl is already the newest version (1.1.0-1).

@zoeliakieaustausch @scooby @RichardW
To fix your error while connecting to inbound email account, unable to connect:
Run these command from the linux terminal:

pear channel-update pear.php.net 
pear install Auth_SASL 
sudo systemctl reload apache2  # for linux server
sudo systemctl reload php-fpm  # for linux server
sudo /opt/bitnami/scripts/apache/reload.sh  # for bitnami container

ā€¦go to Admin, Email, New inbound email account again, whatā€™s the behavior?

NOTE: You may need to fully restart apache to get this new package used by PHP.
In linux server, run:
sudo systemctl restart apache2
In bitnami container, run:
sudo /opt/bitnami/scripts/apache/restart.sh

Picked up the glove againā€¦ no success.

To get more to the bottom of this problem, I installed my own clean version of Plesk and copied the original suiteCRM instance to the new Plesk environment. Still no possibility to connect to the mailserver on the original Plesk server (my mail is located on the same server as the original crm installation).

I added a mailaddress to the new Plesk environment and tried to access this mailaccount from the original suiteCRM instance. That doesnā€™t work either, all the same error-messages about Auth_SASL.

Upgrading SuiteCRM to version 8 also did not solve the problem.

At last, I copied/created a PHP file that accesses the mailaccount using the imap_open function, I think like SuiteCRM does. I installed this file on both Plesk environments, within the SuiteCRM root web directory, executed them and there was no problem reading the mails (on both environments). Apparently, SuiteCRM does something special with imap_open that makes reading the mail on a Plesk environment impossible. But what en is it necessary?

My code example:

<?php
$mailbox = "{server.com:993/imap/ssl/novalidate-cert}INBOX";
$inbox = imap_open($mailbox, "usernamer", "password") or die('Cannot connect to email: ' . imap_last_error());
	
$emails = imap_search($inbox, 'ALL');
if($emails)
{
	foreach($emails as $msg_number) 
	{
		// Get email headers and body
		$header = imap_headerinfo($inbox, $msg_number);
		echo $header->subject;
		echo "\r\n";
	}
}

?>

(using PHP 8.2)

This function findOptimumSettings ā€œprogramatically determines the best-case scenario for imap_openā€ (connect to the IMAP email server):
Would be Very Good to verify this code returns same values, when running on PHP 7.4 and PHP 8.2.

https://github.com/salesagility/SuiteCRM/blame/873557561b8fbed15d586a0d9217037a0b96820c/modules/InboundEmail/InboundEmail.php#L3210

Edited - Post moved to Automatic Import of e-mail | Like how? šŸ“©

Hey @PowerQuest might be a good idea to pose this question in another thread. This one really is about technical connection issues to the email server.

If you want to ask about how people use the email import feature, that really should be another topic. This one is long and convoluted as it is.

1 Like

True, youā€™re correct pstevensā€¦
I started the topic thread long time ago, although kind of related - it does belong as a new topic on itā€™s own. :+1:

I mostly agree: when I use the code as above on a seperate webserver, it works. So I took this code, and implemented it in the InboundEmail.php function as replacement of the getImapConnection function.

protected function getImapConnection($mailbox, $username, $password, $options = 0)
{
$mailbox = ā€œ{mail.winstdelen.com:993/imap/ssl/novalidate-cert}INBOXā€;
$inbox = imap_open($mailbox, $username, $password,) or die('Cannot connect to email: ā€™ . imap_last_error());
}

So in stead of $connection = $this->getImap()->open($mailbox, $username, $password, $options, 0, $params);

The Sugar.log still indicates connection mismatches. I also donā€™t get the folder listings right, also not when in the function getFolderListForMailbox I make use of imap_list instead.

My main concern is to have a few email boxes that are monitored, so my solution will be the following:

  • on my server I will make a php script that I run periodically with a cron job
  • this script will monitor my inbox for new emails
  • when they can be connected with a contact, I will update the CRM database. Thatā€™s quite a bit of tables, but it should work

But if somebody else has a better solution, let me know.

Thereā€™s a fix by pstevens to get Incoming mail and Group Inboxes working.

Which one? I have read a lot from pstevens, but have my php on 7.4 and could for the rest not find a sort of ultimate solution. Outgoing email works fine with me.

Hey @DutchAlfred this is kind of a long thead. What exactly is your issue? Iā€™ll help if I can. BTW I can now import emails on 7.14.3 with PHP version 8.1

Dear pstevens, my main thing is that I have installed SuiteCRM 8.6 and I canā€™t get the inbound email to work. This is by the way the same in 7.14, therefore I now chose to do a fresh 7.11 installation where now everything works.

I noticed that if you put the php version back to 7.4 that the ā€˜Select Inboxā€™ popup appears, but the folder list is empty. All permissions are as wide open as they can.

I must have read practically every post on this topic, even tried to simplify the code and put echoā€™s to the error-log to check that I had the right login credentials, but nothing works. So if you have a clear workaround for this, I would appreciate a step-by-step guide, and many others with me I think.

This may help, my bet is itā€™s not a technical issue, as I have it working on multiple installations.

(this is the second time Iā€™ve added this link today! Good thing I made this video last week).