I am a linux beginner so might be doing something stupid,
My problem,
I am setting up a Ubuntu server LTS 22.04.2, and to get emails when there are updates I am trying to get mail and postfix to work.
I have a very weird problem, I have followed a guide to set up postfix with my gmail account to send with the google smtp server,
when I test this with
echo "Test email" | mail -s "Test subject" email adres
it seems to send ok, output is exited with 0 witch is a success (but not getting mail)
if I than check the que with this command
mailq
than I see the mail in the que with : (connect to smtp.gmail.com[0.0.0.0]:587: Connection refused)
(I dont know why that is saying 0.0.0.0 as adres ??)
But the REAL kicker is, I I than simply reboot my server with "reboot"
one's the server is started, I actualy receive the mail !!!!!!! (even multiple mails if I had more than one in the que)
I am using UFW firewall , but even when disabled I have the same problem.
simply stopping and starting the postfix does NOT work, restarting the postfix service does also NOT work, only thing that works is fully rebooting the server.
Edit : some extra log information ;
mail.log when I try to send a mail that stay's stuck in the que;
Jun 6 16:07:52 theboyz postfix/smtp[5425]: D14805E8FF6: [email protected], relay=none, delay=5.2, delays=5.2/0.02/0/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[0.0.0.0]:587: >
Jun 6 16:07:53 theboyz postfix/postfix-script[5474]: refreshing the Postfix mail system
Jun 6 16:07:53 theboyz postfix/master[2082]: reload -- version 3.6.4, configuration /etc/postfix
Mail log after I reboot the server and the mail is send;
Jun 6 18:30:56 theboyz postfix/master[1855]: reload -- version 3.6.4, configuration /etc/postfix
Jun 6 18:30:56 theboyz postfix/smtp[2474]: D14805E8FF6: [email protected], relay=smtp.gmail.com[173.194.69.109]:587, delay=8590, delays=8587/0.12/1.5/0.76, dsn=2.0.0, status=sent (250 2.0.0 OK 168>
Jun 6 18:30:57 theboyz postfix/postfix-script[3298]: refreshing the Postfix mail system
Jun 6 18:30:57 theboyz postfix/master[1855]: reload -- version 3.6.4, configuration /etc/postfix
Jun 6 18:30:57 theboyz postfix/qmgr[3304]: D14805E8FF6: from=root@theboyz, size=324, nrcpt=1 (queue active)
Jun 6 18:30:57 theboyz postfix/qmgr[3304]: D14805E8FF6: removed
Jun 6 18:30:57 theboyz postfix/postfix-script[3375]: refreshing the Postfix mail system
Jun 6 18:30:57 theboyz postfix/master[1855]: reload -- version 3.6.4, configuration /etc/postfix
Only difference I see is that the SMTP server has an IP of 0.0.0.0 when it fails, and in the logs when I reboot it gets an IP ? so I gues "something" is still starting that screws this up, but my firewall is even disabled for the moment.
extra edit , when I telnet the google smtp server I also get the weird 0.0.0.0 IP ??
telnet smtp.gmail.com 587
Trying 0.0.0.0...
Trying ::...
telnet: Unable to connect to remote host: Connection refused
root@theboyz:~#
I have been reading up on it and I find site's suggesting its a problem with sending IPV6 but the server only understanding IPV4 ?? but still no clue why it works during reboot ??
Can anyone maybey point me in the correct direction ?
Thank you in advance,
Hans