Email and port issues


i have an erpnext instance running on a docker behind a “firewall”.

When adding an email account, I run into issues.

After reading here, I guess, I need to open ports that erpnext can connect to the mail server.

Does someone knows, which port are needed? I read here a lot: from 22 over 143 up to 8080.

Could someone help me out in this points?


Ports may differ on each mail system, depending on protocol (POP, IMAP …) , security implementations … (SSL, TLS …) , etc …

Ask your mail provider, or check how your mail account is configured on other client/devices.
Hope this helps.

Hi avc,

my provider ask for

imap 993 (SSL) or 143 (startTLS)
smtp 587 (startTLS) or 465 (TLS)

But this doesnt bring success :frowning:

Please, share the error message you are getting.
Have you seen any errors on Mail Queue? (you can find it on search bar)

Incoming email account not correct

Error connecting IMAP/POP3 “”: [Errno -3] Temporary failure in name resolution

In the email queue is nothing

Seems domain name is not reachable … is your mail domain ?
I don’t think so :slight_smile:

Check your mail settings.

ah, no :slight_smile:
I just masked the mail server…

Ok! :sweat_smile:

Seems that your mail domain is not reachable, or your frappe/erpenxt server is not able to resolve the dns “” (your real mail server host). Have you access to console? Can you ping to “”? Has your server internet access? :innocent:

Anyway, you can try with IP address instead host name. Or use hosts file (usually at etc/hosts)

Yes, i have ssh access.

when I use the IP instead of domain name I get no feedback. After “save” the screen is stucked.

Are you trying with settings on the mail account? Or using domain doctype? Same error with both options?

Can you test with another mail account (google, etc …)? This will help to discern what kind of problem is there. Communication/connectivity or just missconfiguring issue.

I tried it with email account and email domain. Both with errors.

As I use this email already with several clients, I guess it is a connectivity problem. It is the first time that I configure a docker behind a “firewall”.

I can ping the email domain from my host.

I add another DNS server as a try for just in case.

When I press “save” the screen darken a bit and freeze. But after some time it comes back without any saving or error feedback.

Another thought: my email client on my pc is behind my router too. There is no problem accessing my emails.

This are the feedback from erpnext:


Search “Email Domain” doctype. Is there any data? Try to delete.
Is there any mail account with domain " new-email-domain-1" ? Try to delete or edit it …


nice to see you.

In email domain is just the record “

Seems that “new-email-domain-1” is linked (somehow) to any of your accounts (doctype Email Account). Check out you email queue too (“Email queue” doctype) and try to delete outoing messages if are there …

Next step: exorcism :slight_smile:

Yes, i add an individual account too. This is erased now. I erased the “” too.
I tried name and IP of the mail server. I tried “” too.

But unfortunately no success

20:58:36 web.1 | - - [14/Feb/2023 20:58:36] "POST /api/method/frappe.desk.doctype.route_history.route_history.deferred_insert HTTP/1.1" 200 - 20:59:25 web.1 | /home/frappe/bench/apps/frappe/frappe/email/doctype/email_domain/ DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead 20:59:25 web.1 | logger.warn('Incoming email account "{host}" not correct'.format(host=self.email_server), exc_info=e) 20:59:25 web.1 | - - [14/Feb/2023 20:59:25] "POST /api/method/ HTTP/1.1" 417 -

Maybe it helps:

I do not have ssh access to the container. I am new in the topic container.

Container is running in “bridge” mode, which means, it has it’s own IP address.

Probably due to use IP address instead host name.

If you revert and set hostname and save … what do you get on console or bench log?

‘21:53:39 web.1 | /home/frappe/bench/apps/frappe/frappe/email/doctype/email_domain/ DeprecationWarning: The ‘warn’ method is deprecated, use ‘warning’ instead
21:53:39 web.1 | logger.warn(‘Incoming email account “{host}” not correct’.format(host=self.email_server), exc_info=e)
21:53:39 web.1 | - - [14/Feb/2023 21:53:39] “POST /api/method/ HTTP/1.1” 417 -
21:54:01 web.1 | - - [14/Feb/2023 21:54:01] “GET / HTTP/1.1” 200 -
21:54:25 web.1 | - - [14/Feb/2023 21:54:25] “GET / HTTP/1.1” 200 -’

This is the result.

what I see: the erpnext docker is running on

I can see which is the IP of the virtual switch and ending in the network card.

The IP is another virtual switch and another card. could be that my machine is using both but maybe I just misconfigure the docker container?

Seems not a network/comm issue … What’s your frappe version?

Probably related to this.

Can you share your email account configuration? (mask your user data)