Thursday, February 20, 2025

Re: Sieve rules and OpenSMTPD

On Thu, Feb 20, 2025 at 01:33:52PM +0300, Maksim Rodin wrote:
> Hello,
> > Is sometwo@mydomain.tld 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:<sometwo@mydomain.tld"
> it says:
> "250 2.1.5 Destination address valid: Recipient ok"

>
> I get the same result if I use an external address
> instead of sometwo@mydomain.tld 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 "someone@mydomain.tld"
> > > contains a single line:
> > >
> > > """
> > > redirect "sometwo@mydomain.tld";
> > > """
> > >
> > > After enabling this rule and sending mail to the mailbox
> > > "someone@mydomain.tld" I see the following it the maillog:
> > >
> > > """
> > > 1) Feb 20 09:18:21 mail smtpd[6741]: 6979ad3753eb0f9d smtp failed-command
> > > command="RCPT TO:<sometwo@mydomain.tld> "
> > > result="550 Invalid recipient: <sometwo@mydomain.tld>"
> > > 2) Feb 20 09:18:21 mail dovecot: lmtp: Error: sendmail: command failed:
> > > 550 Invalid recipient: <sometwo@mydomain.tld>
> > > 3) Feb 20 09:18:21 mail dovecot: lmtp(someone@mydomain.tld)<39847>
> > > <oA1MJC3JtmenmwAAZU03Dg>: Error:
> > > sieve: msgid=<7224e316-1b0f-4c00-b5df-4302523d210e@mydomain.tld>:
> > > redirect action: failed to redirect message to <sometwo@mydomain.tld>:
> > > 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:<sometwo@mydomain.tld> "
> > > """
> > >
> > > but I am not sure if I can do something with this.
> > > I tried to write the rule like this:
> > >
> > > """
> > > redirect "<sometwo@mydomain.tld>";
> > > """
> > >
> > > 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 "xyz@mydomain.tld";' rules that are
> > correctly forwarded by OpenSMTPd (7.6-stable, also with Dovecot).
> >
> > Is sometwo@mydomain.tld 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
>
> С уважением,
> Родин Максим
>

--

No comments:

Post a Comment