albertito / chasquid

SMTP (email) server with a focus on simplicity, security, and ease of operation [mirror]
https://blitiri.com.ar/p/chasquid/
Other
868 stars 56 forks source link

Send-only server: `Destination address is unknown` when sending to local domain #32

Closed usrtax closed 1 year ago

usrtax commented 1 year ago

I configured a smtp only chasquid ( with host user.tax , base on https://github.com/albertito/chasquid/issues/30 ) , I use forwardemail.net forword email to gmail for receive mail (it already works)

chasquid send to any other email ( for example iuser.link@gmail.com ) address is ok

but send to xx@user.tax will cause error :

Can't send mail - all recipients were rejected: 550 5.1.1 Destination address is unknown (user does not exist)

how to config chasquid fix this ?

lib/shared/index.js:629 › [2022-10-08 08:07:23] DEBUG Creating transport: nodemailer (6.8.0; +https://nodemailer.com/; SMTP/6.8.0[client:6.8.0])
lib/shared/index.js:629 › [2022-10-08 08:07:23] DEBUG Sending mail using SMTP/6.8.0[client:6.8.0]
lib/shared/index.js:629 › [2022-10-08 08:07:23] DEBUG [4EQYKNFOGCE] Resolved smtp.user.tax as 62.171.170.189 [cache miss]
lib/shared/index.js:629 › [2022-10-08 08:07:24] INFO  [4EQYKNFOGCE] Secure connection established to 62.171.170.189:465
lib/shared/index.js:629 › [2022-10-08 08:07:26] DEBUG [4EQYKNFOGCE] S: 220 smtp.user.tax ESMTP chasquid
lib/shared/index.js:629 › [2022-10-08 08:07:26] DEBUG [4EQYKNFOGCE] C: EHLO mac.local
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250-smtp.user.tax - Your hour of destiny has come.
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250-8BITMIME
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250-PIPELINING
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250-SMTPUTF8
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250-ENHANCEDSTATUSCODES
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250-SIZE 52428800
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250-AUTH PLAIN
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] S: 250 HELP
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] SMTP handshake finished
lib/shared/index.js:629 › [2022-10-08 08:07:29] DEBUG [4EQYKNFOGCE] C: AUTH PLAIN AGlAdXNlci50YXgALyogc2VjcmV0ICov
lib/shared/index.js:629 › [2022-10-08 08:07:30] DEBUG [4EQYKNFOGCE] S: 235 2.7.0 Authentication successful
lib/shared/index.js:629 › [2022-10-08 08:07:30] INFO  [4EQYKNFOGCE] User "i@user.tax" authenticated
lib/shared/index.js:629 › [2022-10-08 08:07:30] INFO  Sending message <7e8bfffa-0329-0b02-baa5-38739aa0bc1a@user.tax> to <xx@user.tax>
lib/shared/index.js:629 › [2022-10-08 08:07:30] DEBUG [4EQYKNFOGCE] C: MAIL FROM:<i@user.tax>
lib/shared/index.js:629 › [2022-10-08 08:07:30] DEBUG [4EQYKNFOGCE] S: 250 2.1.5 You feel like you are being watched
lib/shared/index.js:629 › [2022-10-08 08:07:30] DEBUG [4EQYKNFOGCE] C: RCPT TO:<xx@user.tax>
lib/shared/index.js:629 › [2022-10-08 08:07:30] DEBUG [4EQYKNFOGCE] S: 550 5.1.1 Destination address is unknown (user does not exist)
lib/shared/index.js:629 › [2022-10-08 08:07:30] DEBUG [4EQYKNFOGCE] Closing connection to the server using "end"
lib/shared/index.js:629 › [2022-10-08 08:07:30] ERROR Send error for <7e8bfffa-0329-0b02-baa5-38739aa0bc1a@user.tax>: Can't send mail - all recipients were rejected: 550 5.1.1 Destination address is unk
nown (user does not exist)
albertito commented 1 year ago

What is happening

In your setup, chasquid considers user.tax as a local domain, meaning it's responsible for mails going to it.

So if you send an email to "anything@user.tax", chasquid will try to deliver it locally, and in your example, the user is unknown and fails. This is what I was referring to in this previous answer.

How to fix it

You should add aliases for the users you want to have, forwarding their emails to the right location.

In your case, if you want to forward email that is sent to "anything@user.tax" to a single account like i.user.tax@gmail.com, you put the following in /etc/chasquid/domains/user.tax/aliases:

*: i.user.tax@gmail.com

Note that is a relatively new feature (called a catch-all alias) and requires chasquid 1.10 or newer.

I hope this helps!

usrtax commented 1 year ago

it works , thanks very much

I add this in aliases

i: i.user.tax@gmail.com
*: i.user.tax@gmail.com

i is for smtp send account