Re: Ignore subdomain in lmtp/rcpt-to

2017-11-01 Thread Edgar Pettijohn
On Wed, Nov 01, 2017 at 10:31:19PM +0100, Matthias Teege wrote:
> On Wed, Nov 01, 2017 at 08:43:01PM +0100, Thomas Bohl wrote:
> 
> Hello!
> 
> > > If I send a message from local the FQDN is added so the mail is send
> > > to u...@host.example.com. Is it possible to ignore the "host." part or
> > > rewrite the address to u...@example.com?
> > 
> > # echo example.com > /etc/mail/mailname
> 
> I've tried it but it does not solve the problem:
>  
>  $ mail -v user
>  <<< 220 host.example.com ESMTP OpenSMTPD
>  >>> EHLO localhost
>  <<< 250-host.example.com Hello localhost [local], pleased to meet you
>  <<< 250-8BITMIME
>  <<< 250-ENHANCEDSTATUSCODES
>  <<< 250-SIZE 36700160
>  <<< 250 HELP
>  >>> MAIL FROM:
>  <<< 250 2.0.0: Ok
>  >>> RCPT TO:
>  <<< 250 2.1.5 Destination address valid: Recipient ok
>  >>> DATA
>  <<< 354 Enter mail, end with "." on a line by itself
>  >>> .
>  <<< 250 2.0.0: 1dbf7b05 Message accepted for delivery
>  >>> QUIT
>  <<< 221 2.0.0: Bye
> 
>  Nov  1 22:08:35 host smtpd[31333]:  mda event=delivery 
> evpid=1dbf7b05c357c219 from= 
> to= user=user method=lmtp delay=1m30s result=TempFail 
> stat=Error ("smtpd: RCPT TO rejected: 550 5.1.1  User 
> doesn't exist: u...@host.example.com")
> 
> OpenSMTP accepts the mail. The error message comes from dovecot because
> dovecot only knows u...@example.com.
> 
> The server is the MX for example.com and host.example.com. Mails for
> u...@host.example.com should go to user u...@example.com. Is it possible
> to setup a mapping from host.example.com to example.com?
> 
> Thanks!
> Matthias
>

I think you will get the desired results with aliases.

# cat /etc/mail/aliases
user: u...@example.com

> 
> -- 
> You received this mail because you are subscribed to misc@opensmtpd.org
> To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org
> 

-- 
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org



Re: Ignore subdomain in lmtp/rcpt-to

2017-11-01 Thread Thomas Bohl
Hi,

>> # echo example.com > /etc/mail/mailname
> 
> I've tried it but it does not solve the problem:
>  
>  $ mail -v user
>  <<< 220 host.example.com ESMTP OpenSMTPD
>  >>> EHLO localhost
>  <<< 250-host.example.com Hello localhost [local], pleased to meet you
>  <<< 250-8BITMIME
>  <<< 250-ENHANCEDSTATUSCODES
>  <<< 250-SIZE 36700160
>  <<< 250 HELP
>  >>> MAIL FROM:
>  <<< 250 2.0.0: Ok
>  >>> RCPT TO:
>  <<< 250 2.1.5 Destination address valid: Recipient ok
>  >>> DATA
>  <<< 354 Enter mail, end with "." on a line by itself
>  >>> .
>  <<< 250 2.0.0: 1dbf7b05 Message accepted for delivery
>  >>> QUIT
>  <<< 221 2.0.0: Bye
> 
>  Nov  1 22:08:35 host smtpd[31333]:  mda event=delivery 
> evpid=1dbf7b05c357c219 from= 
> to= user=user method=lmtp delay=1m30s result=TempFail 
> stat=Error ("smtpd: RCPT TO rejected: 550 5.1.1  User 
> doesn't exist: u...@host.example.com")

Can you post your full configuration? Because it should work
immediately. See:

# smtpd -h
version: OpenSMTPD 6.0.0
usage: smtpd [-dFhnv] [-D macro=value] [-f file] [-P system] [-T trace]
# cat /etc/mail/mailname
sw3
# mail -v root
Subject: test1
fdsa
EOT
<<< 220 sw3 ESMTP OpenSMTPD
>>> EHLO localhost
<<< 250-sw3 Hello localhost [local], pleased to meet you
<<< 250-8BITMIME
<<< 250-ENHANCEDSTATUSCODES
<<< 250-SIZE 36700160
<<< 250 HELP
>>> MAIL FROM:
<<< 250 2.0.0: Ok
>>> RCPT TO:
<<< 250 2.1.5 Destination address valid: Recipient ok
>>> DATA
<<< 354 Enter mail, end with "." on a line by itself
>>> .
<<< 250 2.0.0: d847a29a Message accepted for delivery
>>> QUIT
<<< 221 2.0.0: Bye

# echo test.example.com > /etc/mail/mailname
# mail -v root
Subject: test2
fdsa
EOT
<<< 220 sw3 ESMTP OpenSMTPD
>>> EHLO localhost
<<< 250-sw3 Hello localhost [local], pleased to meet you
<<< 250-8BITMIME
<<< 250-ENHANCEDSTATUSCODES
<<< 250-SIZE 36700160
<<< 250 HELP
>>> MAIL FROM:
<<< 250 2.0.0: Ok
>>> RCPT TO:
<<< 550 Invalid recipient
send-mail: command failed: 550 Invalid recipient

# echo foo.bar > /etc/mail/mailname
# mail -v root
Subject: test3
fdsa
EOT
<<< 220 sw3 ESMTP OpenSMTPD
>>> EHLO localhost
<<< 250-sw3 Hello localhost [local], pleased to meet you
<<< 250-8BITMIME
<<< 250-ENHANCEDSTATUSCODES
<<< 250-SIZE 36700160
<<< 250 HELP
>>> MAIL FROM:
<<< 250 2.0.0: Ok
>>> RCPT TO:
<<< 550 Invalid recipient
send-mail: command failed: 550 Invalid recipient

# echo sw3 > /etc/mail/mailname
# mail -v root
Subject: test-ok
fdsa
EOT
<<< 220 sw3 ESMTP OpenSMTPD
>>> EHLO localhost
<<< 250-sw3 Hello localhost [local], pleased to meet you
<<< 250-8BITMIME
<<< 250-ENHANCEDSTATUSCODES
<<< 250-SIZE 36700160
<<< 250 HELP
>>> MAIL FROM:
<<< 250 2.0.0: Ok
>>> RCPT TO:
<<< 250 2.1.5 Destination address valid: Recipient ok
>>> DATA
<<< 354 Enter mail, end with "." on a line by itself
>>> .
<<< 250 2.0.0: d0bfadd9 Message accepted for delivery
>>> QUIT
<<< 221 2.0.0: Bye

It's not even necessary to restart smtpd after changes to
/etc/mail/mailname.

-- 
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org



Re: Ignore subdomain in lmtp/rcpt-to

2017-11-01 Thread Matthias Teege
On Wed, Nov 01, 2017 at 08:43:01PM +0100, Thomas Bohl wrote:

Hello!

> > If I send a message from local the FQDN is added so the mail is send
> > to u...@host.example.com. Is it possible to ignore the "host." part or
> > rewrite the address to u...@example.com?
> 
> # echo example.com > /etc/mail/mailname

I've tried it but it does not solve the problem:
 
 $ mail -v user
 <<< 220 host.example.com ESMTP OpenSMTPD
 >>> EHLO localhost
 <<< 250-host.example.com Hello localhost [local], pleased to meet you
 <<< 250-8BITMIME
 <<< 250-ENHANCEDSTATUSCODES
 <<< 250-SIZE 36700160
 <<< 250 HELP
 >>> MAIL FROM:
 <<< 250 2.0.0: Ok
 >>> RCPT TO:
 <<< 250 2.1.5 Destination address valid: Recipient ok
 >>> DATA
 <<< 354 Enter mail, end with "." on a line by itself
 >>> .
 <<< 250 2.0.0: 1dbf7b05 Message accepted for delivery
 >>> QUIT
 <<< 221 2.0.0: Bye

 Nov  1 22:08:35 host smtpd[31333]:  mda event=delivery 
evpid=1dbf7b05c357c219 from= to= 
user=user method=lmtp delay=1m30s result=TempFail stat=Error ("smtpd: RCPT TO 
rejected: 550 5.1.1  User doesn't exist: 
u...@host.example.com")

OpenSMTP accepts the mail. The error message comes from dovecot because
dovecot only knows u...@example.com.

The server is the MX for example.com and host.example.com. Mails for
u...@host.example.com should go to user u...@example.com. Is it possible
to setup a mapping from host.example.com to example.com?

Thanks!
Matthias


-- 
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org



Re: Ignore subdomain in lmtp/rcpt-to

2017-11-01 Thread Thomas Bohl
> If I send a message from local the FQDN is added so the mail is send
> to u...@host.example.com. Is it possible to ignore the "host." part or
> rewrite the address to u...@example.com?

# echo example.com > /etc/mail/mailname

-- 
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org



Ignore subdomain in lmtp/rcpt-to

2017-11-01 Thread Matthias Teege
Hello!

I'm deliver my mail with lmtp using the following config line:

  accept from local for local alias  deliver to lmtp 
"/var/dovecot/lmtp" rcpt-to

If I send a message from local the FQDN is added so the mail is send
to u...@host.example.com. Is it possible to ignore the "host." part or
rewrite the address to u...@example.com?

Thanks!
Matthias


-- 
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org