Unreliable Email

So, I’m trying CyberPanel and it seems that email is super unreliable here. It works and stops working and works again and stops working.

When I try to send email it shows ( can’t connect to server ).

No ports are blocked. I already tried issuing SSL again for mail server and everything.

I’m tired of having this failing. What can I do?

root@vykix:~# systemctl status dovecot
● dovecot.service - Dovecot IMAP/POP3 email server
Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2023-01-23 20:21:54 UTC; 46s ago

2023-01-23 22:22:05.356518 [NOTICE] [188:8150-3#cyberpanel:lsapi] [STDERR] SERVICE WARNING: - Can’t connect to host “tcp://localhost:587” @ /usr/local/CyberCP/public/snappymail/snappymail/v/2.15.3/app/libraries/MailSo/Net/NetClient.php#194
2023-01-23 22:28:34.950392 [INFO] [188:8183] Connection idle time too long: 301 while in state: 2 watching for event: 4, close!

Randomly is showing this.

Happy New Year @nlkocx

  1. Are you able to send emails?
  2. Are you able to receive emails?
  3. Are you able to setup your email account in an email client such as Bluebird, Outlook etc?

I wasn’t able to receive neither send.

All I saw on SnappyMail when I was trying to send a email was: can’t connect to server

and in logs was:

2023-01-23 22:22:05.356518 [NOTICE] [188:8150-3#cyberpanel:lsapi] [STDERR] SERVICE WARNING: - Can’t connect to host “tcp://localhost:587” @ /usr/local/CyberCP/public/snappymail/snappymail/v/2.15.3/app/libraries/MailSo/Net/NetClient.php#194
2023-01-23 22:28:34.950392 [INFO] [188:8183] Connection idle time too long: 301 while in state: 2 watching for event: 4, close!

Looks like a simple auth & security layer issue. Start by checking if you have sasl abstraction library and modules installed:

dpkg -l | grep sasl

Use this checklist to see if your postfix is setup correctly:

$ nano /etc/postfix/master.cf

Look up at the beginning if you have these directives:

#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd

# @josephgodwinke says:  if you are using spamassissin this directive will be set automatically. If you do not have it ignore this part
# smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin


#smtp      inet  n       -       n       -       1       postscreen
#smtpd     pass  -       -       n       -       -       smtpd
#dnsblog   unix  -       -       n       -       0       dnsblog
#tlsproxy  unix  -       -       n       -       0       tlsproxy
submission inet n       -       n       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions
  -o smtpd_helo_restrictions=$mua_helo_restrictions
  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       n       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions

Now check $ nano /etc/postfix/main.cf || vi /etc/postfix/main.cf

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destinat>
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem

If you just added either of these you will need to restart postfix sudo service postfix restart || sudo systemctl restart postfix

If you dont mind post your mailserver domain we see if there is an issue with ssl certificate validity

ii  libauthen-sasl-perl                   2.1600-1                                   all          Authen::SASL - SASL Authentication framework
ii  libsasl2-2:amd64                      2.1.27+dfsg-2ubuntu0.1                     amd64        Cyrus SASL - authentication abstraction library
ii  libsasl2-dev                          2.1.27+dfsg-2ubuntu0.1                     amd64        Cyrus SASL - development files for authentication abstraction library
ii  libsasl2-modules:amd64                2.1.27+dfsg-2ubuntu0.1                     amd64        Cyrus SASL - pluggable authentication modules
ii  libsasl2-modules-db:amd64             2.1.27+dfsg-2ubuntu0.1                     amd64        Cyrus SASL - pluggable authentication modules (DB)
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin
#smtp      inet  n       -       n       -       1       postscreen
#smtpd     pass  -       -       n       -       -       smtpd
#dnsblog   unix  -       -       n       -       0       dnsblog
#tlsproxy  unix  -       -       n       -       0       tlsproxy
submission inet n       -       n       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions
  -o smtpd_helo_restrictions=$mua_helo_restrictions
  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       n       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions
  -o smtpd_helo_restrictions=$mua_helo_restrictions
  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING

Mail server domain sent to your private dm

As expected you have not setup DNS record for your mailserver domain.

  1. The certificate is self-signed and Common name: mail.billing.xxxx.com.
  2. You also do not have a rDNS ptr record

Solution:

  1. Create a rDNS ptr record where you purchased the server. Post your provider here or pm I will help you with this.
  2. You need to reissue mailserver ssl after you have setup a CNAME record for mail.xxxx.com on cloudflare.

Incase you need me any hand holding send me a request on pm

This is perfect

I’ve sent you a dm

Did you receive my dm? Thank you…

@nlkocx Kindly check and revert back