Updating to 7.14.2 causes issues with any imap port longer than 3 digits

My IMAP server uses a reverse proxy and I connect via port 7993. The issue is that adding 4 digits to the Inbound Email server port adds a comma so 7,993. I had this issue a few releases ago and with the awesome help of the community we were able to discover that the vardefs file in InboundEmail had a character type of int. Chaning this to varchar or text fixed my issue.

Link To Original issue

This obviously wasn’t upgrade safe, but it was an acceptable fix. After upgrading to 7.14.2 however this fix no longer works. After making changes to the vardef file, I know get an invalid port message on the Inbound Email settings.

Any ideas what’s going on?

Running PHP 8.1

After changing the vardefs, did you run a QR&R and scroll down to the bottom, and run any queries proposed there?

I did, yes a couple of times.

I see these errors in the log:

Tue Jan 2 07:55:01 2024 [8647][1][FATAL] InboundEmail::connectMailserver - Invalid port provided: ‘7993’. See valid_imap_ports config.
Tue Jan 2 07:55:01 2024 [8647][1][FATAL] InboundEmail::connectMailserver - Invalid port provided: ‘7993’. See valid_imap_ports config.

I’ve figured it out.

There’s a section in the config.php file for valid IMAP ports. I just added 7993, did a quick repair and all is good now.

1 Like

You could share your config.php file’s updated code here. Thank you!

Sure, below are the relevant changes for both files:

/modules/InboundEmail/vardefs.php

 'port' => [
            'name' => 'port',
            'vname' => 'LBL_SERVER_PORT',
            'type' => 'varchar',
            'len' => '5',
            'default' => '143',
            'required' => true,
            'reportable' => false,
            'massupdate' => false,
            'inline_edit' => false,
            'importable' => false,
            'exportable' => false,
            'unified_search' => false,
            'validation' => ['type' => 'range', 'min' => '110', 'max' => '65535'],
            'comment' => 'Port used to access mail server'

***search for lbl_server_port, and change the type to varchar

/config.php

'valid_imap_ports' =>
  array (
    0 => '110',
    1 => '143',
    2 => '993',
    3 => '995',
    4 => '7993',

***search for valid_imap_ports in your config.php file and add your IMAP port here, like I did with 7993

I hope this helps.

I am using suitecrm version 7.14.2 on windows hosted VM i am getting error as InboundEmail::connectMailserver - Invalid port provided: ‘143’. See valid_imap_ports config.
Mon Oct 14 13:12:54 2024 [7328][1][FATAL] SCHEDULERS: could not get an IMAP connection resource for ID [ 457f5062-5502-0f70-978f-66ffd6d014aa ]. Skipping mailbox [ Email To Case ].
and php version is 8.2 while same instance is working on linux hosted VM not getting any error 143 port is already there in config.php file can any body please help me?

Make sure port 143 is not already in the use.

Other thing, check your firewall. Maybe it is blocking it.

Check if you have a config_override.php that changes the valid_imap_ports configuration that you created in config.php.

Thanks for your reply there is no blocking from firewall end and port 143 is not in use anywhere. also checked in config_overide.php not changing valid_imap_ports . In linux hosted instance with same configuration it is working.

Can you get a debugger and check the variable values at this point?

SuiteCRM-Core/public/legacy/modules/InboundEmail/InboundEmail.php at hotfix · salesagility/SuiteCRM-Core · GitHub

thanks for the reply can you please elaborate what should be done with this i am not able to understand provided input from your side

That would make sense if you were a developer, but I guess you’re not, sorry for making my answer too technical…

Can you post here exactly what you have in config.php, in the valid_imap_ports setting?

yes i am not a devloper :grinning: please refer below valid_imap_ports from config.php

array (
0 => ‘110’,
1 => ‘143’,
2 => ‘993’,
3 => ‘995’,
),

When you save the email account, and open the record to edit the account again, does the port 143 appear to be saved correctly? Or does it get lost?