SOGO autoreply uses a wrong FROM address

Hi,

When a user enables the autoreply feature in SOGo, outgoing messages are generated with a malformed FROM address using the internal hostname (mail.myserver.be.localhost) rather than the actual mail domain (myserver.be). Since neither SPF nor DKIM can validate this internal domain, Gmail rejects the message with a 550 5.7.26 authentication failure.

EDIT : MAIL_DOMAIN and LDAP_DOMAIN are correctly set in the environment config file.

De: Mail Delivery System <MAILER-DAEMON@mail.myserver.be.localhost>
Objet: Undelivered Mail Returned to Sender
Date: 27 juillet 2026 à 11:40:43 UTC+2
À: user@mail.myserver.be.localhost

This is the mail system at host mail.myserver.be.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                  The mail system

<someone@gmail.com>: host gmail-smtp-in.l.google.com[142.251.127.27] said:
   550-5.7.26 Your email has been blocked because the sender is
   unauthenticated. 550-5.7.26 Gmail requires all senders to authenticate with
   either SPF or DKIM. 550-5.7.26  550-5.7.26  Authentication results:
   550-5.7.26  DKIM = did not pass 550-5.7.26  SPF [mail.myserver.be.localhost]
   with ip: [188.34.138.54] = did not 550-5.7.26 pass 550-5.7.26  550-5.7.26
   For instructions on setting up authentication, go to 550 5.7.26
   https://support.google.com/mail/answer/81126#authentication
   ffacd0b85a97d-47f86b0b8e6si30927831f8f.302 - gsmtp (in reply to end of DATA
   command)
Reporting-MTA: dns; mail.myserver.be
X-Postfix-Queue-ID: 9ECF513068B0
X-Postfix-Sender: rfc822; user@mail.myserver.be.localhost
Arrival-Date: Mon, 27 Jul 2026 09:40:42 +0000 (UTC)

Final-Recipient: rfc822; someone@gmail.com
Original-Recipient: rfc822;someone@gmail.com
Action: failed
Status: 5.7.26
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.7.26 Your email has been blocked because the
   sender is unauthenticated. 550-5.7.26 Gmail requires all senders to
   authenticate with either SPF or DKIM. 550-5.7.26  550-5.7.26
   Authentication results: 550-5.7.26  DKIM = did not pass 550-5.7.26  SPF
   [mail.myserver.be.localhost] with ip: [188.34.138.54] = did not 550-5.7.26
   pass 550-5.7.26  550-5.7.26  For instructions on setting up authentication,
   go to 550 5.7.26
   https://support.google.com/mail/answer/81126#authentication
   ffacd0b85a97d-47f86b0b8e6si30927831f8f.302 - gsmtp

De: <user@myserver.be>
Objet: Auto: Re: Planning des prochains mois
Date: 27 juillet 2026 à 11:40:42 UTC+2
À: Someone <someone@gmail.com>


Bonjour, 
Je suis en congé et je reviendrai le lundi 27 juillet.
A bientôt !

How would I correct this ?

Thanks

Matthieu

There was another user who saw this too NS8 / SOGo : vacation message not working - #31 by hazarder

BTW that’s the same server / instance where I fixed another problem regarding vacation messages last year. Looks like there is something that changed meanwhile. That kind of issue looks usual with Sogo :frowning:

Hey Matthieu,

it was all fixed when SPF and DKIM were set for sending domain.

Strange, but it worked, no matter for .localhost suffix.

Regards, Tomaz

Hi @Pagaille,

I think I may have found the root cause, but I’d like to check my understanding with you.

Last year you added the following Dovecot override yourself:

“sieve_vacation_send_from_recipient = yes”

Was the only reason for this that your smarthost rejects messages with a null envelope sender (“<>”)?

If so, I wonder if this is actually exposing a deeper issue in “ns8-mail”.

From what I can see, NS8 builds “myorigin” as “.localhost” (in “reload-config”) and routes internal mail through that domain. As a result, the final LMTP recipient becomes something like:

“user@mail.myserver.be.localhost”

With “sieve_vacation_send_from_recipient = yes”, Pigeonhole uses that final recipient as the envelope sender, so the internal “.localhost” domain leaks to the outside world.

Could this be what you’re seeing?

If that’s the case, the real issue would not be SOGo. SOGo only generates the Sieve script and sets the “From:” header correctly. Instead, it looks like the combination of Dovecot, Postfix and the NS8 mail routing causes the invalid envelope sender. Rspamd then refuses to DKIM-sign because the envelope domain no longer matches the “From:” header domain, which ultimately results in Gmail rejecting the message.

Does that match your setup and the behavior you observed? Or am I missing something?

Indeed. That’s exactly whats happening. The only weird thing is that it used to work.