Import of e-mail fail...🙀

Ok Chris, tnx. I installed the php-auth-sasl package on my test-server. Can you help me out how to set CRAM-MD5 login by default for PHPmailer? Is that a setting somewhere? I use Plesk.

@RichardW my mistake, PHPmailer is for outgoing email, this thread is about incoming email. To set outgoing email to use CRAM-MD5 auth, you’d set this in the phpmailer config:
$mail->AuthType = 'CRAM-MD5';

@zoeliakieaustausch Is it possible one of these settings wasn’t set properly while using PHP 8?
Strato IMAP Server (incoming mail) : imap.strato.de
IMAP port: 993
IMAP security: SSL / TLS
IMAP username: Your full email address
IMAP password: Your Strato.de password

Strato SMTP Server (outgoing mail): smtp.strato.de
SMTP port: 465
SMTP security: SSL / TLS
SMTP username: Your full email address
SMTP password: Your Strato.de password

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