Linux Postfix Mail Server task on Linux level 2

Hi,
Can somebody from Kodekloud engineer support manually pass this task for me please? No matter how many times I’ve completed and successfully tested mail flow it returns an error saying - Mail not received!, 'dovecot' is not configured correctly on Mail Server when clearly it works. Maybe there is something wrong with the test script?? I’ve finished every other task in this section and would like to mark it as complete so I can add more from the ciriculum.

Many thanks
Steve

FYI steps taken:

install and configure postfix

yum install -y postfix

vi /etc/postfix/main.cf

edit /enable settings in main.cf file


myhostname = stmail01.stratos.xfusioncorp.com

mydomain = stratos.xfusioncorp.com

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

mynetworks = 172.16.238.17/24, 172.16.239.3/24,127.0.0.0/8

home_mailbox = Maildir/

create user

useradd javed

passwd paswoord

test postfix smtp


[root@stmail01 ~]# telnet stmail01 25

Trying 172.16.238.17...

Connected to stmail01.

Escape character is '^]'.

220 stmail01.stratos.xfusioncorp.com ESMTP Postfix

EHLO localhost

250-stmail01.stratos.xfusioncorp.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-STARTTLS

250-ENHANCEDSTATUSCODES

250-8BITMIME

250-DSN

250-SMTPUTF8

250 CHUNKING

mail from:[email protected]

250 2.1.0 Ok

rcpt to:[email protected]

250 2.1.5 Ok

DATA

354 End data with <CR><LF>.<CR><LF>

test mail

.

250 2.0.0 Ok: queued as 2F58D2C0DDBF

quit

221 2.0.0 Bye

Connection closed by foreign host.

install and configure dovecot

yum install -y dovecot

vi /etc/dovecot/dovecot.conf


listen = *, ::

protocols = imap pop3 lmtp submission

vi /etc/dovecot/conf.d/10-mail.conf


mail_location = maildir:~/Maildir

vi /etc/dovecot/conf.d/10-auth.conf


disable_plaintext_auth = yes

auth_mechanisms = plain login

vi /etc/dovecot/conf.d/10-master.conf


unix_listener auth-userdb {

#mode = 0666

user = postfix

group = postfix

}

test dovecot imap


[root@stmail01 ~]# telnet stmail01 110

Trying 172.16.238.17...

Connected to stmail01.

Escape character is '^]'.

+OK Dovecot ready.

user javed

+OK

pass TmPcZjtRQx

+OK Logged in.

retr 1

+OK 513 octets

Return-Path: <[email protected]>

X-Original-To: [email protected]

Delivered-To: [email protected]

Received: from localhost (stmail01 [172.16.238.17])

by stmail01.stratos.xfusioncorp.com (Postfix) with ESMTP id 2F58D2C0DDBF

for <[email protected]>; Fri, 28 Feb 2025 10:43:00 +0000 (UTC)

Message-Id: <[email protected]>

Date: Fri, 28 Feb 2025 10:43:00 +0000 (UTC)

From: [email protected]

test mail

.

quit

+OK Logging out.

Connection closed by foreign host.

check network ports are listening

ss -tulnp

I’ve just listed out the differences, what worked for me was:

In /etc/postfix/main.cf

myhostname = stratos.xfusioncorp.com
mydomain = xfusioncorp.com

In /etc/dovecot/conf.d/10-master.conf

unix_listener auth-userdb {
    mode = 0666
    user = postfix
    group = postfix
  }
service dict {
    unix_listener dict {
      mode = 0600
      user = postfix
      group = postfix
    }

and also create Maildir and change its ownership

One tip regarding adding topics to curriculum: You can remove the existing ones, your progress wouldn’t be lost.

Thanks for the response. I’ll give it a go just to clear the tester, but looking at your configuration it is technically incorrect. As you can see, I can send and read mail.
myhostname in postfix is supposed to be the FQDN of the actual mailserver and my domain(s) should match the email domain you’re sending to stratos.xfusioncorp.com. The Maildr is automatically created for each user by the service. I’ve set quite a lot of mail servers up in my time. I appreciate your comment though and I’ve had to make odd configuration choices on this platform just to clear the tester or sometime ambiguous questions. Maybe I have missed something, so it would be great if a Kodekloud person can comment
Many thanks
Steve