LibreNMS SMTP agent doesn't appear to be RFC2821 compliant?

I am running LibreNMS at home on a dedicated box on a fairly large network. I am trying to configure SMTP Alerts and having a problem with SMTP.

The LibreNMS box is called “netman” (FQDN “netman.tubby.org”),

When it connects to our mail server and enters SMTP dialogue it’s HELO/EHLO is rejected because it does not comply with RFC2821:

2026-02-18 12:11:27 H=xxxxxxxxxx.tubby.org (netman) [xx.xx.xx.xx] rejected EHLO or HELO netman: Your HELO/EHLO greeting (netman) is a single word. According to RFC2821 you must use your fully-qualified domain-name. Please fix your configuration if you want to talk to us

The LibreNMS SMTP agent should be saying “HELO netman.tubby.org” or “EHLO netman.tubby.org” to be compliant with RFC2821.

I can’t see an obvious way to fix this in the system configuration.

When the SMTP connector/agent generates the HELO/EHLO string to send to the SMTP server it needs to use the contents of ‘hostname -f’ rather than just ‘hostname’.

Is there a way to fix this?

Mike

We gather the hostname to use with php_uname(‘a’).

php -r 'echo php_uname("n");'

That is always going to return the short hostname only and results in a single word that doesn’t comply with the FQDN requirement in RFC2821 ?

php -r ‘echo gethostbyaddr(gethostbyname(gethostname()));’

returns the FQDN as a string and I suggest would be a better bet :wink:

If you can tell me where this in the code then I’ll patch it and try it and report back …

Mike

LibreNMS/Util/Mail.php
77: $mail->Hostname = php_uname(‘n’);

I’ve patched the code and can confirm that it resolves the issue for me.

I am now getting emails in the form:

LibreNMS Alert Mail
Severity: critical
Timestamp: 2026-02-06 19:55:14
Unique-ID: 1154
Rule:  Device Down! Due to no ICMP response.  Faults:
  #1: sysObjectID = .1.3.6.1.4.1.8072.3.2.10; sysDescr = REDACTED
6.12.57+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.57-1 (2025-11-05)
x86_64; location_id = 11; 
Alert sent to: REDACTED

The patch for this change is:

root@netman:/opt/librenms/LibreNMS/Util# diff Mail.php Mail.php-orig
77c77
< $mail->Hostname = gethostbyaddr(gethostbyname(gethostname()));
---
> $mail->Hostname = php_uname('n');

Regards

Mike

Please submit the fix upstream although I’ve not validated what you’ve changed but that will get looked at.