stalwartlabs / mail-server

Secure & Modern All-in-One Mail Server (IMAP, JMAP, POP3, SMTP)
https://stalw.art
5.08k stars 206 forks source link

[enhancement]: Add support for IP address relaying #838

Open 1e99 opened 2 weeks ago

1e99 commented 2 weeks ago

What happened?

When setting up stalwart to relay outgoing EMail through another server, stalwart always tries to make a MX lookup, even if the relay server is referred to by IP.

I would expect stalwart to not make MX lookups for an IP.

How can we reproduce the problem?

This is my config as it stands now, the relay server can be reached using 10.0.0.1:26. This doesn't work as stalwart wants to lookup the MX record for the IP. When I set the address to a domain that resolves to 10.0.0.1, it works. In my case I can set it to relay.mail.1e99.eu. I have a MX record for 1e99.eu that links to mail.1e99.eu.

[queue.outbound]
next-hop = [
        { if = "is_local_domain('*', rcpt_domain)", then = "'local'" },
        { else = "'tunnel'" }
]
tls.mta-sts = "disable"
tls.dane = "disable"

[remote.tunnel]
address = "10.0.0.1"
port = 26
protocol = "smtp"
auth.username = "secret_username"
auth.secret = "secret_password"
tls.implicit = false
tls.allow-invalid-certs = true

Version

v0.10.x

What database are you using?

RocksDB

What blob storage are you using?

Filesystem

Where is your directory located?

Internal

What operating system are you using?

Docker

Relevant log output

2024-10-06T08:19:40Z INFO IP address lookup failed (delivery.ip-lookup-failed) queueId = 201164651925618690, from = "1e99@1e99.eu", to = ["<test>@gmail.com"], size = 1153, total = 1, domain = "gmail.com", hostname = "10.0.0.1", details = "Permanent Failure: Connection to '10.0.0.1' failed: record not found for MX", elapsed = 4ms

Code of Conduct

fatal-bundy commented 2 weeks ago

Hi,

while yes semantical. i think this would be considered a bug rather than an enhancement. the help box says one can use an IP and the example on empty box is 127.0.0.1 suggesting further one can use an IP in the remote field.

Note. I ran in to this issue the other day as well and intending to raise a rub report for it.