Mailserver not working

SYSTEM INFORMATION
OS type and version Ubuntu 22-04-3
Webmin version 2.105
Virtualmin version 7.8.2 GPL
Related packages Postfix, Bind

Hi, I’m trying to configure the mailserver(s), without success.
My main hostname is hosting1.domain1.com, and I created (imported from Plesk) a domain2.com

I do have a PTR for domain1.com (the same domain was working for Plesk), and I am using the same DNS records I already had for domain2.com (MX, SPF, DMARK, DKIM).

Now, if I send a mail to my gmail account from user@domain2.com, I get the followig error:

Dec 14 11:12:49 hosting1 postfix/smtpd[91513]: connect from localhost[127.0.0.1]
Dec 14 11:12:49 hosting1 postfix/smtpd[91513]: 7DF5B4A014F: client=localhost[127.0.0.1]
Dec 14 11:12:49 hosting1 postfix/cleanup[91516]: 7DF5B4A014F: message-id=<1702548769.91504@worldsinperil.it>
Dec 14 11:12:49 hosting1 opendkim[53869]: 7DF5B4A014F: DKIM-Signature field added (s=202311, d=worldsinperil.it)
Dec 14 11:12:49 hosting1 postfix/qmgr[77869]: 7DF5B4A014F: from=<urbaman@worldsinperil.it>, size=1014, nrcpt=1 (queue active)
Dec 14 11:12:49 hosting1 postfix/smtpd[91513]: disconnect from localhost[127.0.0.1] helo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Dec 14 11:12:49 hosting1 postfix/smtp[91517]: warning: DNSSEC validation may be unavailable
Dec 14 11:12:49 hosting1 postfix/smtp[91517]: warning: reason: dnssec_probe 'ns:.' received a response that is not DNSSEC validated
Dec 14 11:12:49 hosting1 postfix/smtp[91517]: connect to gmail-smtp-in.l.google.com[2a00:1450:4025:402::1b]:25: Network is unreachable
Dec 14 11:12:50 hosting1 postfix/smtp[91517]: 7DF5B4A014F: to=<urbaman@gmail.com>, relay=gmail-smtp-in.l.google.com[142.250.102.27]:25, delay=1, delays=0.12/0.04/0.34/0.53, dsn=5.7.25, status=bounced (host gmail-smtp-in.l.google.com[142.250.102.27] said: 550-5.7.25 [194.163.174.60] The IP address sending this message does not have a 550-5.7.25 PTR record setup, or the corresponding forward DNS entry does not 550-5.7.25 point to the sending IP. As a policy, Gmail does not accept messages 550-5.7.25 from IPs with missing PTR records. For more information, go to 550 5.7.25  https://support.google.com/mail/answer/81126#ip-practices b18-20020a1709062b5200b00a1d7b96dbd7si6366834ejg.213 - gsmtp (in reply to end of DATA command))
Dec 14 11:12:50 hosting1 postfix/cleanup[91516]: 85DB24A07DA: message-id=<20231214101250.85DB24A07DA@hosting1.urbaman.it>
Dec 14 11:12:50 hosting1 postfix/qmgr[77869]: 85DB24A07DA: from=<>, size=4515, nrcpt=1 (queue active)
Dec 14 11:12:50 hosting1 postfix/bounce[91521]: 7DF5B4A014F: sender non-delivery notification: 85DB24A07DA
Dec 14 11:12:50 hosting1 postfix/qmgr[77869]: 7DF5B4A014F: removed
Dec 14 11:12:51 hosting1 spamd[82697]: spamd: connection from 127.0.0.1 [127.0.0.1]:34338 to port 783, fd 5
Dec 14 11:12:51 hosting1 spamd[82697]: spamd: setuid to worldsinperil succeeded
Dec 14 11:12:51 hosting1 spamd[82697]: spamd: processing message <20231214101250.85DB24A07DA@hosting1.urbaman.it> for worldsinperil:1001
Dec 14 11:12:51 hosting1 spamd[82697]: spamd: clean message (-0.0/5.0) for worldsinperil:1001 in 0.4 seconds, 4513 bytes.
Dec 14 11:12:51 hosting1 spamd[82697]: spamd: result: . 0 - HTML_MESSAGE,NO_RELAYS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED scantime=0.4,size=4513,user=worldsinperil,uid=1001,required_score=5.0,rhost=127.0.0.1,raddr=127.0.0.1,rport=34338,mid=<20231214101250.85DB24A07DA@hosting1.urbaman.it>,autolearn=ham autolearn_force=no
Dec 14 11:12:51 hosting1 postfix/local[91522]: 85DB24A07DA: to=<worldsinperil@hosting1.urbaman.it>, orig_to=<urbaman@worldsinperil.it>, relay=local, delay=0.97, delays=0/0.01/0/0.97, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Dec 14 11:12:51 hosting1 postfix/qmgr[77869]: 85DB24A07DA: removed
Dec 14 11:12:51 hosting1 spamd[82692]: prefork: child states: II

If I try to send an email from gmail to user@domain2.com I cannot see it in user’s mailbox, with the following related logs

Dec 14 17:09:20 hosting1 postfix/smtpd[106264]: connect from mail-io1-f47.google.com[209.85.166.47]
Dec 14 17:09:21 hosting1 postfix/smtpd[106264]: 4F8AD4A09F8: client=mail-io1-f47.google.com[209.85.166.47]
Dec 14 17:09:21 hosting1 postfix/cleanup[106268]: 4F8AD4A09F8: message-id=<CAByz5hG_taMzNHDfCiHwtXiMMvXTN90WrC56DwuVnG=sX78Ghg@mail.gmail.com>
Dec 14 17:09:21 hosting1 opendkim[53869]: 4F8AD4A09F8: DKIM verification successful
Dec 14 17:09:21 hosting1 opendkim[53869]: 4F8AD4A09F8: s=20230601 d=gmail.com a=rsa-sha256 SSL
Dec 14 17:09:21 hosting1 postfix/qmgr[77869]: 4F8AD4A09F8: from=<urbaman@gmail.com>, size=2573, nrcpt=1 (queue active)
Dec 14 17:09:21 hosting1 postfix/smtpd[106264]: disconnect from mail-io1-f47.google.com[209.85.166.47] ehlo=2 starttls=1 mail=1 rcpt=1 bdat=1 quit=1 commands=7
Dec 14 17:09:21 hosting1 spamd[82697]: spamd: connection from 127.0.0.1 [127.0.0.1]:38938 to port 783, fd 5
Dec 14 17:09:21 hosting1 spamd[82697]: spamd: setuid to worldsinperil succeeded
Dec 14 17:09:21 hosting1 spamd[82697]: spamd: processing message <CAByz5hG_taMzNHDfCiHwtXiMMvXTN90WrC56DwuVnG=sX78Ghg@mail.gmail.com> for worldsinperil:1001
Dec 14 17:09:22 hosting1 spamd[82697]: spamd: clean message (-5.2/5.0) for worldsinperil:1001 in 0.3 seconds, 2864 bytes.
Dec 14 17:09:22 hosting1 spamd[82697]: spamd: result: . -5 - DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE scantime=0.3,size=2864,user=worldsinperil,uid=1001,required_score=5.0,rhost=127.0.0.1,raddr=127.0.0.1,rport=38938,mid=<CAByz5hG_taMzNHDfCiHwtXiMMvXTN90WrC56DwuVnG=sX78Ghg@mail.gmail.com>,autolearn=ham autolearn_force=no
Dec 14 17:09:22 hosting1 postfix/local[106269]: 4F8AD4A09F8: to=<worldsinperil@hosting1.urbaman.it>, orig_to=<urbaman@worldsinperil.it>, relay=local, delay=1, delays=0.21/0.01/0/0.78, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Dec 14 17:09:22 hosting1 postfix/qmgr[77869]: 4F8AD4A09F8: removed
Dec 14 17:09:22 hosting1 spamd[82692]: prefork: child states: II

So: do I need PTR for both domain1.com and domain2.com? How to make the received mail to be put in the right mailbox?

Thank you very much

You either don’t have port 25 or you’ve been specifically blocked by Google. Probably the former. Many hosting providers (especially cloud providers) prohibit use of port 25 to prevent spam. Some will open the port on request, others you have to use a relay service.

Hi,

I think I do have port 25 open, and I think also google is reachable, as the following line has google’s response about my PTR.

I did resolve PTR problem, I just have to make let’s encrypt work for the hostname.domain1.com from webmin as it actually goes to a directory of domain2

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for hosting1.dreamlord.it

Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
  Domain: hosting1.dreamlord.it
  Type:   unauthorized
  Detail: 194.163.174.60: Invalid response from https://www.worldsinperil.it/.well-known/acme-challenge/9UlwdiaV0fhS0dzTzExZP-EVKYraMlHlg4_CwUddcWU: 404

Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

Then, I’ll be able to make cloudflare’s DNS grey and make the PTR work.

Still cannot understand why I so not receive anu mail

Thank you!

So you’re proxying those records?
Anything mail related should not be proxied. There are some docs on CF regarding this specifically.

I do have a second VPS (older one) and the A record associated to the PTR is proxied. It can send mails to google. I’ll make some tests to see if I can get it work.

I also cannot understand (second issue) why I do not receive mail in the mailboxes.

I think you need to be sure you have port 25 available. I see no evidence of it in the logs above.

I mean, you need to test that (incoming and outgoing). Stop guessing.

no port 25 open see here 2 attempts

notice the connection to virtualmin.com works as port 25 is open

No port 25, no mail server.

Dude, why are you even trying to contact CloudFlare on port 25?
Like I mentioned above, records relating to mail can not be proxied, it will never work.

CF Docs here.

@urbaman it’s not about the PTR itself, but rather the A record associated with the MX records for a particular domain.

Dude
didn’t you read

it needs a direct connection or a relay to work

Exactly, but port 25 won’t work through CF.
Which is what I told him earlier, no need to telnet that.

He has outgoing port 25 working on IPv4 which is clear from the logs, IPv6 is another issue…

Hi,

Thank you guys and sorry for probably having put up a little mess.

  • If you try to telnet/connect, it’s probably not working as I’m also trying different setups to fix it, so probably you’re not getting through but it shouldn’t be a problem.
  • I know of CF proxy problem, I also have a Plesk VPS perfectly working (the one I’m trying to migrate from), thing is: I do not seem to get the same setup working.
  • My problems are actually three:
  1. outbound mails to gmail getting bounced
  2. inbound mails not getting to the mailboxes (I should receive the postmaster mails for the bounced mails, and other normal mails)
  3. getting the ssl cert with LE for webmin/virtualmin as it seems to always try the virtual server instead of the default one.

I’m still getting around the first problem, googling around I see so many solutions but none of them seems to work.

For the inbound mails problem, I think they’re getting through, as you can see from the logs they trigger procmail and things. It’s clearly managing a mail from my gmail account and it got through, it just does not pop up in the mailbox:

Dec 14 17:09:20 hosting1 postfix/smtpd[106264]: connect from mail-io1-f47.google.com[209.85.166.47]
Dec 14 17:09:21 hosting1 postfix/smtpd[106264]: 4F8AD4A09F8: client=mail-io1-f47.google.com[209.85.166.47]
Dec 14 17:09:21 hosting1 postfix/cleanup[106268]: 4F8AD4A09F8: message-id=<CAByz5hG_taMzNHDfCiHwtXiMMvXTN90WrC56DwuVnG=sX78Ghg@mail.gmail.com>
Dec 14 17:09:21 hosting1 opendkim[53869]: 4F8AD4A09F8: DKIM verification successful
Dec 14 17:09:21 hosting1 opendkim[53869]: 4F8AD4A09F8: s=20230601 d=gmail.com a=rsa-sha256 SSL
Dec 14 17:09:21 hosting1 postfix/qmgr[77869]: 4F8AD4A09F8: from=<urbaman@gmail.com>, size=2573, nrcpt=1 (queue active)
Dec 14 17:09:21 hosting1 postfix/smtpd[106264]: disconnect from mail-io1-f47.google.com[209.85.166.47] ehlo=2 starttls=1 mail=1 rcpt=1 bdat=1 quit=1 commands=7
Dec 14 17:09:21 hosting1 spamd[82697]: spamd: connection from 127.0.0.1 [127.0.0.1]:38938 to port 783, fd 5
Dec 14 17:09:21 hosting1 spamd[82697]: spamd: setuid to worldsinperil succeeded
Dec 14 17:09:21 hosting1 spamd[82697]: spamd: processing message <CAByz5hG_taMzNHDfCiHwtXiMMvXTN90WrC56DwuVnG=sX78Ghg@mail.gmail.com> for worldsinperil:1001
Dec 14 17:09:22 hosting1 spamd[82697]: spamd: clean message (-5.2/5.0) for worldsinperil:1001 in 0.3 seconds, 2864 bytes.
Dec 14 17:09:22 hosting1 spamd[82697]: spamd: result: . -5 - DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE scantime=0.3,size=2864,user=worldsinperil,uid=1001,required_score=5.0,rhost=127.0.0.1,raddr=127.0.0.1,rport=38938,mid=<CAByz5hG_taMzNHDfCiHwtXiMMvXTN90WrC56DwuVnG=sX78Ghg@mail.gmail.com>,autolearn=ham autolearn_force=no
Dec 14 17:09:22 hosting1 postfix/local[106269]: 4F8AD4A09F8: to=<worldsinperil@hosting1.urbaman.it>, orig_to=<urbaman@worldsinperil.it>, relay=local, delay=1, delays=0.21/0.01/0/0.78, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Dec 14 17:09:22 hosting1 postfix/qmgr[77869]: 4F8AD4A09F8: removed
Dec 14 17:09:22 hosting1 spamd[82692]: prefork: child states: II

As for the third problem, I’m still trying to solve it.

As an aside, yesterday night (CEST) it seemd to me that CF’s DNSs where slow to propagate, as I wasn’t getting the same results from my VPS and from my home network. Some cache thing probably messing around and making my setup faulty. Let’s see if they get stable and fix my problems.

But see: inbound mails problems doesn’t seem to be tied to DNS/CF cache/proxy problem. They get trhough to the server but do not get to the mailboxes in Usermin.

Thank you very much!

Hi,

Sorry for bumping up: I solved the sendig problem (now google accepts my emails).

Still have receiving problems: it seems mail sent to name@worldsinperil.it get rewritten to worldsinperil@hosting1.urbaman.it:

Dec 19 12:52:13 hosting1 postfix/smtpd[90633]: connect from mail-io1-f49.google.com[209.85.166.49]
Dec 19 12:52:14 hosting1 postfix/smtpd[90633]: AD31E481D42: client=mail-io1-f49.google.com[209.85.166.49]
Dec 19 12:52:14 hosting1 postfix/cleanup[90636]: AD31E481D42: message-id=<CAByz5hHQHZ2keghcbiM_AA5Dgw_5HFCwB8pGC_DNuRKqsG91gw@mail.gmail.com>
Dec 19 12:52:14 hosting1 opendkim[85400]: AD31E481D42: DKIM verification successful
Dec 19 12:52:14 hosting1 opendkim[85400]: AD31E481D42: s=20230601 d=gmail.com a=rsa-sha256 SSL
Dec 19 12:52:14 hosting1 postfix/qmgr[47332]: AD31E481D42: from=<urbaman@gmail.com>, size=2583, nrcpt=1 (queue active)
Dec 19 12:52:15 hosting1 postfix/smtpd[90633]: disconnect from mail-io1-f49.google.com[209.85.166.49] ehlo=2 starttls=1 mail=1 rcpt=1 bdat=1 quit=1 commands=7
Dec 19 12:52:15 hosting1 spamd[67302]: spamd: connection from 127.0.0.1 [127.0.0.1]:58554 to port 783, fd 5
Dec 19 12:52:15 hosting1 spamd[67302]: spamd: setuid to worldsinperil succeeded
Dec 19 12:52:15 hosting1 spamd[67302]: spamd: processing message <CAByz5hHQHZ2keghcbiM_AA5Dgw_5HFCwB8pGC_DNuRKqsG91gw@mail.gmail.com> for worldsinperil:1001
Dec 19 12:52:15 hosting1 spamd[67302]: spamd: clean message (-0.2/5.0) for worldsinperil:1001 in 0.6 seconds, 2880 bytes.
Dec 19 12:52:15 hosting1 spamd[67302]: spamd: result: . 0 - BODY_SINGLE_WORD,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SCC_BODY_SINGLE_WORD,SPF_HELO_NONE,SPF_PASS,TVD_SPACE_RATIO,T_SCC_BODY_TEXT_LINE scantime=0.6,size=2880,user=worldsinperil,uid=1001,required_score=5.0,rhost=127.0.0.1,raddr=127.0.0.1,rport=58554,mid=<CAByz5hHQHZ2keghcbiM_AA5Dgw_5HFCwB8pGC_DNuRKqsG91gw@mail.gmail.com>,autolearn=ham autolearn_force=no
**Dec 19 12:52:15 hosting1 postfix/local[90685]: AD31E481D42: to=<worldsinperil@hosting1.urbaman.it>, orig_to=<worldsinperil@worldsinperil.it>, relay=local, delay=1.2, delays=0.13/0.01/0/1.1, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)**
Dec 19 12:52:15 hosting1 postfix/qmgr[47332]: AD31E481D42: removed
Dec 19 12:52:15 hosting1 spamd[67301]: prefork: child states: II

Also from procmail, it seems mails for different mailboxes go to the same one:

From urbaman@gmail.com  Tue Dec 19 13:10:04 2023
 Subject: Prova
  Folder: /home/worldsinperil/Maildir/new/1702987806.98504_0.hosting1.     3225
Time:1702987806 From:urbaman@gmail.com To:worldsinperil@worldsinperil.it User:worldsinperil Size:3274 Dest:/home/worldsinperil/Maildir/new/1702987806.98504_0.hosting1.urbaman.it Mode:None
From urbaman@gmail.com  Tue Dec 19 13:12:39 2023
 Subject: Prova
  Folder: /home/worldsinperil/Maildir/new/1702987959.98904_0.hosting1.     3194
Time:1702987959 From:urbaman@gmail.com To:admin@worldsinperil.it User:worldsinperil Size:3243 Dest:/home/worldsinperil/Maildir/new/1702987959.98904_0.hosting1.urbaman.it Mode:None

And I do have mail dirs:

ls /home/worldsinperil/homes
admin  urbaman  webmaster  worldsinperil  world_wp

But all of the mails seem to go to the main maildir:

ls /home/worldsinperil/Maildir/new
1702986284.88423_1.hosting1.urbaman.it  1702986735.90687_0.hosting1.urbaman.it  1702987806.98504_0.hosting1.urbaman.it
1702986298.88563_0.hosting1.urbaman.it  1702986749.90713_0.hosting1.urbaman.it  1702987959.98904_0.hosting1.urbaman.it

Ok,

Set all imported mail users “Primary Email Address enabled” and everything worls.

Thank you!

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.