Unable to send or Receive email

I am unable to send or get email via rainloop. It always says “Can’t Send Message”

Blow are the logs for journalctl -f | grep postfix command:

can you tell me why It happens

Mar 22 09:53:37 ip-192-35-63-50 postfix/qmgr[18505]: 97DB58617C: from=<>, size=2322, nrcpt=1 (queue active)
Mar 22 09:54:07 ip-192-35-63-50 postfix/smtp[24248]: connect to gmail-smtp-in.l.google.com[173.194.204.26]:25: Connection timed out
Mar 22 09:54:07 ip-192-35-63-50 postfix/smtp[24248]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400d:c07::1a]:25: Network is unreachable
Mar 22 09:54:37 ip-192-35-63-50 postfix/smtp[24248]: connect to alt1.gmail-smtp-in.l.google.com[64.233.186.26]:25: Connection timed out
Mar 22 09:54:37 ip-192-35-63-50 postfix/smtp[24248]: connect to alt1.gmail-smtp-in.l.google.com[2800:3f0:4003:c00::1a]:25: Network is unreachable
Mar 22 09:54:43 ip-192-35-63-50 postfix/submission/smtpd[24272]: warning: cannot get RSA certificate from file “/etc/pki/dovecot/certs/dovecot.pem”: disabling TLS support
Mar 22 09:54:43 ip-192-35-63-50 postfix/submission/smtpd[24272]: warning: TLS library problem: error:02001002:system library:fopen:No such file or directory:…/crypto/bio/bss_file.c:290:fopen(‘/etc/pki/dovecot/certs/dovecot.pem’,‘r’):
Mar 22 09:54:43 ip-192-35-63-50 postfix/submission/smtpd[24272]: warning: TLS library problem: error:20074002:BIO routines:file_ctrl:system lib:…/crypto/bio/bss_file.c:292:
Mar 22 09:54:43 ip-192-35-63-50 postfix/submission/smtpd[24272]: warning: TLS library problem: error:140DC002:SSL routines:use_certificate_chain_file:system lib:…/ssl/ssl_rsa.c:615:
Mar 22 09:54:43 ip-192-35-63-50 postfix/submission/smtpd[24272]: connect from localhost[127.0.0.1]
Mar 22 09:54:43 ip-192-35-63-50 postfix/cleanup[24273]: EEB1283051: message-id=[email protected]
Mar 22 09:54:43 ip-192-35-63-50 postfix/qmgr[18505]: EEB1283051: from=[email protected], size=869, nrcpt=1 (queue active)
Mar 22 09:54:43 ip-192-35-63-50 postfix/submission/smtpd[24272]: disconnect from localhost[127.0.0.1] ehlo=1 starttls=0/1 quit=1 commands=2/3
Mar 22 09:54:44 ip-192-35-63-50 postfix/smtp[24274]: EEB1283051: to=[email protected], orig_to=, relay=none, delay=0.05, delays=0.01/0.01/0.02/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=server.example.com type=AAAA: Host not found)
Mar 22 09:54:44 ip-192-35-63-50 postfix/bounce[24275]: warning: EEB1283051: undeliverable postmaster notification discarded
Mar 22 09:54:44 ip-192-35-63-50 postfix/qmgr[18505]: EEB1283051: removed

have you set up an SSL certificate for your hostname and mailserver? This would suggest that you have not.

id=[email protected]

Digitalocean - Problems with cyberpanel SSL certificate expired for use with smtp after renew using let’s encrypt. You can’t send emails using smtp server.

Cyberpanel version 2.1 - Ubuntu 20.04

  1. Step 1 - Check if your droplet is with this problem:
    =======================================================

openssl s_client -starttls smtp -showcerts -connect mail.yourdomain.com:25 -servername mail.yourdomain.com

Example:
CONNECTED(00000003)
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let’s Encrypt, CN = R3
verify return:1
depth=0 CN = mail.yourdomain.com
verify error:num=10:certificate has expired
notAfter=May 18 18:33:25 2021 GMT
verify return:1
depth=0 CN = mail.yourdomain.com
notAfter=May 18 18:33:25 2021 GMT
verify return:1

Certificate chain
0 s:CN = mail.yourdomain.com
i:C = US, O = Let’s Encrypt, CN = R3
-----BEGIN CERTIFICATE-----


Start Time: 1622929789
Timeout : 7200 (sec)
Verify return code: 10 (certificate has expired)
Extended master secret: no
Max Early Data: 0

read R BLOCK

You need to go step 2:


 SOLUTION!

Step 2: Run these commands:

postmap -F hash:/etc/postfix/vmail_ssl.map
systemctl restart dovecot.service
systemctl restart postfix

Bingo!

Your mail server will work fine!

Step 3 - Check if your droplet is working fine:

openssl s_client -starttls smtp -showcerts -connect mail.yourdomain.com:25 -servername mail.yourdomain.com
Example:
CONNECTED(00000003)
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let’s Encrypt, CN = R3
verify return:1
depth=0 CN = mail.yourdomain.com
verify return:1

Certificate chain
0 s:CN = mail.yourdomain.com
i:C = US, O = Let’s Encrypt, CN = R3
-----BEGIN CERTIFICATE-----


Start Time: 1622949041
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: no
Max Early Data: 0

read R BLOCK