Local mail sender hostname is wrong when sending via OpenSMTPd

Hello,

I got a problem with local emails on my FreeBSD box after last upgrade of OpenSMTPd 6.6.4p1.
Previously it worked well, but now:

Code:
$ mail -v root
Subject: test
some message
.
EOT
<<< 220 # ESMTP OpenSMTPD
>>> EHLO localhost
<<< 250-# Hello localhost [local], pleased to meet you
<<< 250-8BITMIME
<<< 250-ENHANCEDSTATUSCODES
<<< 250-SIZE 36700160
<<< 250 HELP
>>> MAIL FROM:<alex@#>
<<< 553 5.1.0 Sender address syntax error
sendmail: command failed: 553 5.1.0 Sender address syntax error

I have this in my smtpd.conf:

Code:
listen on $lan_addr inet4 port 25 \
  mask-src
action local_mails \
  lmtp "/var/run/dovecot/lmtp" \
  alias <aliases>
match from local for local \
  action local_mails

I agree that sender address is not correct, but I don't see where can I specify correct hostname in mail command (of course $HOST is set properly).
All the non-local emails are working well.

Aliases is untouched, /etc/dma/dma.conf is also has all the lines commented.
Apparently it is a regression after recent bugfix in OpenSMTPd, but I think the problem is not directly related to that MTA, but more in my environment config.

Probably dma.conf has to be configured properly to set "MAIL FROM:" correctly, this is what I'm going to try.

Any help is welcome...
 
Well, it appears to be a regression on OpenSMTPd side.
When explicitly adding sender address it works:
Code:
> mail -v alex@myhost.name -f root@myhost.name
Subject: test
test message
.
EOT
<<< 220 # ESMTP OpenSMTPD
>>> EHLO localhost
<<< 250-# Hello localhost [local], pleased to meet you
<<< 250-8BITMIME
<<< 250-ENHANCEDSTATUSCODES
<<< 250-SIZE 36700160
<<< 250 HELP
>>> MAIL FROM:<root@myhost.name>
<<< 250 2.0.0 Ok
>>> RCPT TO:<alex@myhost.name>
<<< 250 2.1.5 Destination address valid: Recipient ok
>>> DATA
<<< 354 Enter mail, end with "." on a line by itself
>>> .
<<< 250 2.0.0 b7e8f801 Message accepted for delivery
>>> QUIT
<<< 221 2.0.0 Bye
And this only works when host name is specified in both sender and recipient addresses.
Looking into mail(1) sources shows that it never looks up for the host name and only feeds email to sendmail enqueuer.
This is confirmed with:
Code:
> cat message.txt | sendmail alex@myhost.name
sendmail: command failed: 553 5.1.0 Sender address syntax error
> cat message.txt | sendmail -f root@myhost.name alex@myhost.name
The last command send email correctly.
So, the workaround is clear now.
 
At the moment I set
Code:
sendmail /usr/libexec/dma
in my /etc/mail/mailer.conf and specified
Code:
MAILNAME myhost.name
in /etc/dma/dma.conf.
This involves DMA in delivery chain and it properly sets hostname in sender's address.
It doesn't seem the right config for me, but at least now I don't miss important emails sent by local daemons.
 
Back
Top