In debug mode it turned out that dovecot connects
to smtpd service as ... "local".
Not as locahost, not as 127.0.0.1, not even as real hostname of the
server.
"local" was not in my list of servers allowed to send any mail.
After adding this entry to the list everything works as expected.
Big thanks for help!

On Thu Feb 20 15:47:15 2025, Zé Loff wrote:
> On Thu, Feb 20, 2025 at 01:33:52PM +0300, Maksim Rodin wrote:
> > Hello,
> > > Is [email protected] a valid user as far as OpenSMTPd is concerned?
> > > That is, if you send a message directly to that address, does it get
> > > delivered?
> > Yes. I have Thunderbird with all these test accounts set up.
> > I doublechecked the second address,
> > it is OK and when I write to this email directly it
> > arrives to the right inbox.
> > 
> > If I connect with "telnet localhost 25" sitting in the
> > mail server console and write during the session:
> > "rcpt to:<[email protected]"
> > it says:
> > "250 2.1.5 Destination address valid: Recipient ok"
> 
> > 
> > I get the same result if I use an external address
> > instead of [email protected] in a sieve rule.
> > I can email to any external address directly
> > but redirecting via sieve to that same address
> > fails with the same error in the log.
> > 
> > Btw, I already set up redirection by means of OpenSMTPD with SRS and
> > it works. But now I would like to have the similar functionality
> > available to a mail user as a user.
> > 
> 
> Check if dovecot/sieve is also connecting to localhost, as you did in
> you telnet session (there should be a "smtp connected address=..." line
> just before the "smtp failed-command" you posted), and if it's not, try
> again using that address.
> 
> Posting your smtpd.conf (redacted if needed be) would help.  Probably
> the messages from sieve are matching the wrong rule.  Or try running
> smtpd on the foreground, with "-v", to figure out what is going on
> (maybe "-v" is overkill, "-d -T smtp -T lookup -T expand -T rules" might
> be enough).
> 
> > On Thu Feb 20 09:30:19 2025, Zé Loff wrote:
> > > On Thu, Feb 20, 2025 at 10:11:03AM +0300, Maksim Rodin wrote:
> > > > Hello,
> > > > I am trying to use sieve to forward or redirect messages
> > > > after they reach the dovecot service on my mail server.
> > > > My sieve rule for the mail user "[email protected]" 
> > > > contains a single line:
> > > > 
> > > > """
> > > > redirect "[email protected]";
> > > > """
> > > > 
> > > > After enabling this rule and sending mail to the mailbox
> > > > "[email protected]" I see the following it the maillog:
> > > > 
> > > > """
> > > > 1) Feb 20 09:18:21 mail smtpd[6741]: 6979ad3753eb0f9d smtp 
> > > > failed-command
> > > > command="RCPT TO:<[email protected]> "
> > > > result="550 Invalid recipient: <[email protected]>"
> > > > 2) Feb 20 09:18:21 mail dovecot: lmtp: Error: sendmail: command failed:
> > > > 550 Invalid recipient: <[email protected]>
> > > > 3) Feb 20 09:18:21 mail dovecot: lmtp([email protected])<39847>
> > > > <oA1MJC3JtmenmwAAZU03Dg>: Error:
> > > > sieve: msgid=<[email protected]>:
> > > > redirect action: failed to redirect message to <[email protected]>:
> > > > Sendmail program returned error (temporary failure)
> > > > """
> > > > 
> > > > I suppose OpenSMTPD does not like the "RCPT TO:" part of the mail
> > > > transaction. I only noticed that the error in the log shows an 
> > > > additional space
> > > > after the address:
> > > > """
> > > > smtp failed-command command="RCPT TO:<[email protected]> "
> > > > """
> > > > 
> > > > but I am not sure if I can do something with this.
> > > > I tried to write the rule like this:
> > > > 
> > > > """
> > > > redirect "<[email protected]>";
> > > > """
> > > > 
> > > > But nothing changed.
> > > > Is this a problem with dovecot or OpenSMTPD?
> > > > 
> > > > OpenBSD 6.7 stable
> > > > dovecot 2.3.21.1 (d492236fa0)
> > > > OpenSMTPD 7.6.0
> > > > 
> > > > -- 
> > > > Best regards
> > > > Maksim Rodin
> > > > 
> > > 
> > > FWIW, I have accounts with 'redirect "[email protected]";' rules that are
> > > correctly forwarded by OpenSMTPd (7.6-stable, also with Dovecot).
> > > 
> > > Is [email protected] a valid user as far as OpenSMTPd is concerned?
> > > That is, if you send a message directly to that address, does it get
> > > delivered?
> > > 
> > > 
> > > -- 
> > >  
> > 
> > -- 
> > Best regards
> > Maksim Rodin
> > 
> > С уважением,
> > Родин Максим
> > 
> 
> -- 
>  

-- 
Best regards
Maksim Rodin

С уважением,
Родин Максим

Reply via email to