As part of my enhancements to the home controller, I want to send email warnings of low heating oil level.
So I removed exim which was too much like hard work, installed PostFix
and all is well...,except it isn't.
If I send a mail out of the blue after a a few hours delay, the mail immediately *always* gets stuck in the queue with a message about being unable to determine the IP address of the SMTP relay.
If I send another message everything Just Works, and indeed the h mail
queue gets flushed eventually as well with a successful delivery.
The Natural Philosopher <tnp@invalid.invalid> wrote:
As part of my enhancements to the home controller, I want to send email
warnings of low heating oil level.
So I removed exim which was too much like hard work, installed PostFix
and all is well...,except it isn't.
If I send a mail out of the blue after a a few hours delay, the mail
immediately *always* gets stuck in the queue with a message about being
unable to determine the IP address of the SMTP relay.
If I send another message everything Just Works, and indeed the h mail
queue gets flushed eventually as well with a successful delivery.
'Greylisting'? SMTP servers often delay mail from unrecognised senders as a spam block - spammers tend not come back when told to try again later.
Also the message needs to be correct to match SFP/DKIM/DMARC rules,
otherwise it may get delayed or discarded. It may also be delayed/discarded due to sending from a 'consumer' IP.
Perhaps by the time the second message arrives the spamfilter has decided you're ok and to let the message straight through.
I would not be doing direct SMTP in this day and age - send using an SMTP account (with username/password) at the company who runs the SMTP server for the sender's mail domain.
If the SMTP relay is indeed your domain's mail server, perhaps the first
time DNS lookup is too slow?
Theo--
As part of my enhancements to the home controller, I want to send email warnings of low heating oil level.
In message <10fhnjv$1gvnc$5@dont-email.me>my system is tailored to my needs. It works perfectly. I just need to
The Natural Philosopher <tnp@invalid.invalid> wrote:
As part of my enhancements to the home controller, I want to send email
warnings of low heating oil level.
Have a look at Pushover to see if it would be an alternative way to
meet your needs. I use it to alert myself of problems in my heating
system.
David
Seriously,m its not the server, its the DNS.
It (the PI) cant even *find* the SMTP server
Nov 18 10:46:56 heating-controller postfix/pickup[8654]: CC05B1F270:
uid=0 from=<oil-monitor@heating-controller>
Nov 18 10:46:56 heating-controller postfix/cleanup[10455]: CC05B1F270: message-id=<20251118104656.CC05B1F270@heating-controller>
Nov 18 10:46:56 heating-controller postfix/qmgr[1295]: CC05B1F270: from=<oil-monitor@heating-controller>, size=387, nrcpt=1 (queue active)
Nov 18 10:46:57 heating-controller postfix/smtp[10457]: CC05B1F270: to=<superroot@templar.co.uk>, relay=none, delay=0.38, delays=0.19/0.14/0.04/0, dsn=4.4.3, status=deferred (Host or domain name
not found. Name service error for name=vps.templar.co.uk type=MX: Host
not found, try again)
The Natural Philosopher <tnp@invalid.invalid> wrote:
Seriously,m its not the server, its the DNS.
It (the PI) cant even *find* the SMTP server
Nov 18 10:46:56 heating-controller postfix/pickup[8654]: CC05B1F270:
uid=0 from=<oil-monitor@heating-controller>
Nov 18 10:46:56 heating-controller postfix/cleanup[10455]: CC05B1F270:
message-id=<20251118104656.CC05B1F270@heating-controller>
Nov 18 10:46:56 heating-controller postfix/qmgr[1295]: CC05B1F270:
from=<oil-monitor@heating-controller>, size=387, nrcpt=1 (queue active)
Nov 18 10:46:57 heating-controller postfix/smtp[10457]: CC05B1F270:
to=<superroot@templar.co.uk>, relay=none, delay=0.38,
delays=0.19/0.14/0.04/0, dsn=4.4.3, status=deferred (Host or domain name
not found. Name service error for name=vps.templar.co.uk type=MX: Host
not found, try again)
If it's the only network activity the thing does regularly, maybe
the WiFi interface has gone into some sort of sleep mode and the DNS
resolver isn't waiting for it to wake up. If you leave ping running
(eg. "nohup ping -s 1 vps.templar.co.uk &") to keep the interface
active, maybe it will work the first time?
Or if it doesn't change, you could set the IP address for
vps.templar.co.uk in /etc/hosts.
As part of my enhancements to the home controller, I want to send email warnings of low heating oil level.
Seriously,m its not the server, its the DNS.
Nov 18 10:46:57 heating-controller postfix/smtp[10457]: CC05B1F270: to=<superroot@templar.co.uk>, relay=none, delay=0.38, delays=0.19/0.14/0.04/0, dsn=4.4.3, status=deferred (Host or domain
name not found. Name service error for name=vps.templar.co.uk
type=MX: Host not found, try again)
from=<oil-monitor@heating-controller>
On 18/11/2025 21:08, Computer Nerd Kev wrote:
The Natural Philosopher <tnp@invalid.invalid> wrote:
Seriously,m its not the server, its the DNS.
I was logged in over ssh at the time, so that hound don't hunt :-(It (the PI) cant even *find* the SMTP server
Nov 18 10:46:56 heating-controller postfix/pickup[8654]: CC05B1F270:
uid=0 from=<oil-monitor@heating-controller>
Nov 18 10:46:56 heating-controller postfix/cleanup[10455]: CC05B1F270:
message-id=<20251118104656.CC05B1F270@heating-controller>
Nov 18 10:46:56 heating-controller postfix/qmgr[1295]: CC05B1F270:
from=<oil-monitor@heating-controller>, size=387, nrcpt=1 (queue active)
Nov 18 10:46:57 heating-controller postfix/smtp[10457]: CC05B1F270:
to=<superroot@templar.co.uk>, relay=none, delay=0.38,
delays=0.19/0.14/0.04/0, dsn=4.4.3, status=deferred (Host or domain name >>> not found. Name service error for name=vps.templar.co.uk type=MX: Host
not found, try again)
If it's the only network activity the thing does regularly, maybe
the WiFi interface has gone into some sort of sleep mode and the DNS
resolver isn't waiting for it to wake up. If you leave ping running
(eg. "nohup ping -s 1 vps.templar.co.uk &") to keep the interface
active, maybe it will work the first time?
On 18/11/2025 12:08, The Natural Philosopher wrote:
As part of my enhancements to the home controller, I want to send
email warnings of low heating oil level.
This sounds rather like something I have been planning to do. AAMOI how
are you measuring the oil level?
On 18.11.2025 15:27 Uhr The Natural Philosopher wrote:
from=<oil-monitor@heating-controller>
That is your first problem. Us a real existing address for that.
Do you want to run you own mail domain or do you just want to use a
freemail account for sending that out?
The Natural Philosopher <tnp@invalid.invalid> writes:
On 18/11/2025 21:08, Computer Nerd Kev wrote:
The Natural Philosopher <tnp@invalid.invalid> wrote:
Seriously,m its not the server, its the DNS.
I was logged in over ssh at the time, so that hound don't hunt :-(It (the PI) cant even *find* the SMTP server
Nov 18 10:46:56 heating-controller postfix/pickup[8654]: CC05B1F270:
uid=0 from=<oil-monitor@heating-controller>
Nov 18 10:46:56 heating-controller postfix/cleanup[10455]: CC05B1F270: >>>> message-id=<20251118104656.CC05B1F270@heating-controller>
Nov 18 10:46:56 heating-controller postfix/qmgr[1295]: CC05B1F270:
from=<oil-monitor@heating-controller>, size=387, nrcpt=1 (queue active) >>>> Nov 18 10:46:57 heating-controller postfix/smtp[10457]: CC05B1F270:
to=<superroot@templar.co.uk>, relay=none, delay=0.38,
delays=0.19/0.14/0.04/0, dsn=4.4.3, status=deferred (Host or domain name >>>> not found. Name service error for name=vps.templar.co.uk type=MX: Host >>>> not found, try again)
If it's the only network activity the thing does regularly, maybe
the WiFi interface has gone into some sort of sleep mode and the DNS
resolver isn't waiting for it to wake up. If you leave ping running
(eg. "nohup ping -s 1 vps.templar.co.uk &") to keep the interface
active, maybe it will work the first time?
Was the SSH session actually doing anything? An idle SSH session doesn’t have to exchange any packets at all.
But “it’s always DNS” is a pretty reliable starting point for network debugging, and I think it’s the right one here.
What are you using as a name server? i.e. what is in resolv.conf on this machine?
Nov 18 10:46:57 heating-controller postfix/smtp[10457]: CC05B1F270: to=<superroot@templar.co.uk>, relay=none, delay=0.38, delays=0.19/0.14/0.04/0, dsn=4.4.3, status=deferred (Host or domain
name not found. Name service error for name=vps.templar.co.uk type=MX:
Host not found, try again)
^^^^^^^^^^^^^^^^^^^^^^^^^
It’s a temporary failure, ‘TRY_AGAIN’ ultimately from something in resolv.h or netdb.h, but with a lot of Postfix-specific DNS code around
it.
vps.templar.co.uk. 3600 IN MX 5 vps.templar.co.uk.
Your MX record has 1-hour TTL, so an hour after the last successful
query, your local (or ISP-provided) name server will have to ask domaincontrol.com again. That may explain why ‘a few hours delay’ brings the condition back.
domaincontrol.com seems to be pretty fast from here but if for whatever reason the network between you and domaincontrol is slow or unreliable,
or the name server you’re using is underprovisioned, then that could explain the temporary failures here. By the time you send the another
message everything has caught up, explaining why it works on the second attempt.
On 18/11/2025 12:08, The Natural Philosopher wrote:
As part of my enhancements to the home controller, I want to send email warnings of low heating oil level.
This sounds rather like something I have been planning to do. AAMOI how
are you measuring the oil level?
Indicating a 5 minute delay between being queued and being sent...
Daniel James <daniel@me.invalid> wrote:
On 18/11/2025 12:08, The Natural Philosopher wrote:
As part of my enhancements to the home controller, I want to send email
warnings of low heating oil level.
This sounds rather like something I have been planning to do. AAMOI how
are you measuring the oil level?
FWIW I had one of those Watchman ultrasonic oil tank sensors and I could
pick up the reading via rtl_433 and a cheap RTL2832-based DVB TV dongle.
(as well as the tyres on the car, and various other gizmos locally).
Perhaps a wires-free option if you already have such a sensor?
Theo
The Natural Philosopher wrote:
Indicating a 5 minute delay between being queued and being sent...
grep 300 /etc/postfix/main.cf
maybe tweak smtpd_timeout=nn if that matches
Oh. I designed a board with
- a Pi Pico W.
- a three pin temperature sensor ( TMP36) to monitor outside temperature
- an ultrasonic transmitter/receiver ( HCRS04) on it
- a nano power timer that (Was a sparkfun nano power switch TPL5110
until I blew it up and replaced it with a sub-board with an Adafruit TPL5110 Low Power Timer ) wakes up every 2 hours, tries to make contact
with the wifi, sends a short message to the server, and then commits
suicide and shuts the timer down again.
# dig vps.templar.co.uk
On 19/11/2025 10:08, The Natural Philosopher wrote:
Oh. I designed a board with
- a Pi Pico W.
- a three pin temperature sensor ( TMP36) to monitor outside temperature
- an ultrasonic transmitter/receiver ( HCRS04) on it
- a nano power timer that (Was a sparkfun nano power switch TPL5110
until I blew it up and replaced it with a sub-board with an Adafruit
TPL5110 Low Power Timer ) wakes up every 2 hours, tries to make
contact with the wifi, sends a short message to the server, and then
commits suicide and shuts the timer down again.
OK, thanks. What sort of oil tank do you have and how do you fit the
sensor to it?
I'm part-way through designing something similar myself, but using an ESP8266 to control the sensor and talking mqtt to a Pi (happens to be a Pi3B, because I have one always-on for other things but I could have
used a ZeroW). It's really at Proof-of-Concept stage at present.
I have a 3V-compatible HCSR04 to play with, but was wondering whether an
ir laser ToF device might be better. Those ultrasonic sensors are a bit chunky ... (I'm told there is no chance of the laser in,say, a VL53L1X igniting heating oil vapour!)
I haven't yet put either anywhere near the oil tank, yet. I'm using
readings from a BME280 to test the logic.
I have a "Cheap Yellow Display" (ESP32 with LCD) that acts as a mqtt
client and display panel ... it can record data (but doesn't yet) but
I'll probably want something more sophisticated later ... as I say, it's
all PoC at present.
On 19/11/2025 10:33, The Natural Philosopher wrote:
# dig vps.templar.co.uk
dig -t any .......
On 19/11/2025 11:13, Mike Scott wrote:
On 19/11/2025 10:33, The Natural Philosopher wrote:essentially the same result, but thanks anyway...
# dig vps.templar.co.uk
dig -t any .......
dig -t any vps.templar.co.uk
dig -t any @8.8.8.8 vps.templar.co.uk
One of these basically
https://www.fueltankshop.co.uk/2500-litre-oil-tank-titan-h2500gr/p5305
The tank already had a hole in the top to take an oil watchman sensor,
so I 3d printed a case to use the same mounting holes and gasket. I will need to open up the hole a bit for the ultrasonics
Well since I am 100% custom I didn't bother with mqtt - I simply send a short text string . The more problematical bit is establishing a wifi connection and what to do if it fails to connect.
If I had Ethernet out there I would never have gone to the complexity of battery operation....
[snip]I have a 3V-compatible HCSR04 to play with ...
Good with the 3v version Mine isn't and I expect it to get sketchy at around 3.9V.
If that proves to be a problem I'll probab;y make a new board up and transfer the modules from the existing...
I don't like the commercial solutions that rely on a cloud somewhere.
So no, I don't know what it is now using as a DNS client.
Its very odd. I just did this...
# dig vps.templar.co.uk
; <<>> DiG 9.16.50-Raspbian <<>> vps.templar.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24512
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 7f7ca1b95493f5c601000000691d9a18750f0123b174788b (good)
;; QUESTION SECTION:
;vps.templar.co.uk. IN A
;; ANSWER SECTION:
vps.templar.co.uk. 3726 IN A 185.113.128.151
;; Query time: 9 msec
;; SERVER: 192.168.0.101#53(192.168.0.101)
;; WHEN: Wed Nov 19 10:21:12 GMT 2025
;; MSG SIZE rcvd: 90
...then this...
root@heating-controller:/var/ramlog# echo "This is more bollox isn't
it?" | mail -a "From: oil-monitor@heating-controller" -s "another
message" superroot@templar.co.uk
...and this...
root@heating-controller:/var/ramlog# mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
C459D1FE2E 387 Wed Nov 19 10:21:48 oil-monitor@heating-controller
(Host or domain name not found. Name service error for
name=vps.templar.co.uk type=MX: Host not found, try again)
superroot@templar.co.uk
-- 0 Kbytes in 1 Request.
Now unless dig is using some other means than postfix to look up DNS,
it looks like the problem is in postfix somehow.
On 19/11/2025 07:56, Marco Moock wrote:
On 18.11.2025 15:27 Uhr The Natural Philosopher wrote:
from=<oil-monitor@heating-controller>
That is your first problem. Us a real existing address for that.No. I wont. Because it is effectively private intra domain email.
On 19/11/2025 12:16, The Natural Philosopher wrote:
One of these basically
https://www.fueltankshop.co.uk/2500-litre-oil-tank-titan-h2500gr/p5305
The tank already had a hole in the top to take an oil watchman sensor,
so I 3d printed a case to use the same mounting holes and gasket. I
will need to open up the hole a bit for the ultrasonics
Ours is a steel tank, but it has a tube poking out of the top that has previously accommodated a Watchman sensor.
Housing the electronics is the problem - I had hoped that oil tank
sellers would sell a screw-in cap for the tank opening that I could cannibalize to make an appliance housing, but I haven't found anything suitable (yet).
I really needed an excuse to get into 3D printing. :-)
Well since I am 100% custom I didn't bother with mqtt - I simply send
a short text string . The more problematical bit is establishing a
wifi connection and what to do if it fails to connect.
If I had Ethernet out there I would never have gone to the complexity
of battery operation....
I used MQTT because I already had Mosquitto running on the Pi3B (as part
of a HomeAssistant setup controlling a few Tasmoto switches). I should
not have gone that route otherwise ... but it does work well.
Yes, if I had Ethernet running out to the tank it would all be so
different ... but I'm not drilling a hole through a 60cm stone wall to
get it there!
[snip]I have a 3V-compatible HCSR04 to play with ...
Good with the 3v version Mine isn't and I expect it to get sketchy at
around 3.9V.
If that proves to be a problem I'll probably make a new board up and
transfer the modules from the existing...
Mine is actually an RCWL-1601, which claims HC-SR04 compatibility. It
also claims to support i2c as well as the usual trig/echo signalling,
which will help as me ESP8266 is running out of pins. I may have to
switch to an ESP32 ... but I have a handful of 8266s not doing a lot ...
I don't like the commercial solutions that rely on a cloud somewhere.
No, indeed. I avoid those as much as possible.
The Natural Philosopher <tnp@invalid.invalid> writes:
So no, I don't know what it is now using as a DNS client.
Its very odd. I just did this...
# dig vps.templar.co.uk
; <<>> DiG 9.16.50-Raspbian <<>> vps.templar.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24512
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 7f7ca1b95493f5c601000000691d9a18750f0123b174788b (good)
;; QUESTION SECTION:
;vps.templar.co.uk. IN A
;; ANSWER SECTION:
vps.templar.co.uk. 3726 IN A 185.113.128.151
;; Query time: 9 msec
;; SERVER: 192.168.0.101#53(192.168.0.101)
;; WHEN: Wed Nov 19 10:21:12 GMT 2025
;; MSG SIZE rcvd: 90
...then this...
root@heating-controller:/var/ramlog# echo "This is more bollox isn't
it?" | mail -a "From: oil-monitor@heating-controller" -s "another
message" superroot@templar.co.uk
...and this...
root@heating-controller:/var/ramlog# mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
C459D1FE2E 387 Wed Nov 19 10:21:48 oil-monitor@heating-controller
(Host or domain name not found. Name service error for
name=vps.templar.co.uk type=MX: Host not found, try again)
superroot@templar.co.uk
-- 0 Kbytes in 1 Request.
Now unless dig is using some other means than postfix to look up DNS,
it looks like the problem is in postfix somehow.
Maybe, but the above doesn’t prove it; you’ve asked for an A record but Postfix asks for an MX record, so your lookup won’t have populated the cache (if there is one). (It’ll look for the A record next, but until it’s got the MX record it doesn’t know what A record to ask for.)
If there is doubt about what name server is being used you could use
tcpdump to find out.
sudo tcpdump -np -i br0 udp port 53
Replace br0 with your own network interface. You’ll need to check at
least loopback (lo) and any real network interfaces.
On 18.11.2025 15:27 Uhr The Natural Philosopher wrote:
from=<oil-monitor@heating-controller>
That is your first problem. Us a real existing address for that.
[/etc/resolv.conf] was set to 127.0.0.1 and IIRC dnsmasq was
running. I set it to my internal servers that run BIND but I dont
think its actually using them
So no, I don't know what it is now using as a DNS client.
Now unless dig is using some other means than postfix to look up
DNS, it looks like the problem is in postfix somehow.
On 19/11/2025 12:18, The Natural Philosopher wrote:
On 19/11/2025 11:13, Mike Scott wrote:
essentially the same result, but thanks anyway...
On 19/11/2025 10:33, The Natural Philosopher wrote:
# dig vps.templar.co.uk
dig -t any .......
Hmm, interesting, the result depends, it seems, on the dns server:
On 19.11.2025 10:11 Uhr The Natural Philosopher wrote:
On 19/11/2025 07:56, Marco Moock wrote:
On 18.11.2025 15:27 Uhr The Natural Philosopher wrote:
from=<oil-monitor@heating-controller>
That is your first problem. Us a real existing address for that.
No. I wont. Because it is effectively private intra domain email.
Then make sure your postfix doesn't check that. It seems for me it does.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,089 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 153:50:31 |
| Calls: | 13,921 |
| Calls today: | 2 |
| Files: | 187,021 |
| D/L today: |
3,754 files (944M bytes) |
| Messages: | 2,457,163 |