Mail Relay - to Bridge Cloudron Servers
-
I have this situation coming up over and over - and it is annoying.
Issue: When setting up Cloudron for a client they 1. Have port 25 blocked, 2 do not currently use the other options for email, and 3. would rather not add something to their SPF records just for the sake of sending out individual password reset notifications.So my ideal solution is to use my cloudron server to run these notifications. And for my cloudron server to send using email addresses originating from it's own domain.
So... Cloudron server A (my server) has port 25 available and a happy sending domain.
I want to subscribe Cloudron server B to send all emails from a that happy sending domain described above.
When I do this I get all kinds of errors like
- Email address "admin.app" is not a valid alias to send emails for this user.
and. - Cannot send emails for otherdomain from this domain because bla bla bla
Or - You have to enable server A to receive email in order for server B to connect to it via SMTP and send emails out creating the errors above.
Anyway I would love to find an elegant solution which allows Cloudron-Server-B to send notification emails via a different domain without having to individually enable every single sending address.
- Email address "admin.app" is not a valid alias to send emails for this user.
-
I have a 'hack' for this:
- Add the domain of Cloudron server B into Cloudron server A.
- Disable mail from validation in Cloudron server A for the added domain.
- Create a "relay" user in Cloudron server A and also a
relay@
mailbox. - Set the above credentials as the external relay in Cloudron server B.
This will allow server B to send emails via server A for that specific domain you added. You have to repeat for every domain you want to relay.
-
@subven I agree with that, we are using Postmark, it's $10 per month only for a normal volume and really easy to set up. The deliverability has increased compared to other solutions like a mail package with even an established company in the market.
-
@girish
The problem seems to be that on "Server A" I have to enable mailservices for the domain in question. Then when I try to send mail from Server B theserver B produces an error
{ "ts": 1663009665363, "type": "deferred", "direction": "outbound", "uuid": "B17FA8D4-5997-4FE6-8636-400140195457.1", "messageId": null, "mailFrom": "<>", "spamStatus": null, "rcptTo": [ "<no-reply@serverB.com>" ], "message": "Tried all MXs", "delay": 8192 }
and server A produces the error
{ "ts": 1663009909718, "type": "bounce", "direction": "outbound", "uuid": "380CB958-8DD9-45DC-B9C3-13F89C1FD866.1.1", "messageId": "<f993a729-8533-909f-f3d0-be386c19df96@draglabs.com>", "mailFrom": "<no-reply@draglabs.com>", "spamStatus": null, "rcptTo": [ "<user@serverB.com>" ], "message": "Some recipients failed: <user@serverB.com>", "mx": { "priority": 0, "exchange": "127.0.0.1", "port": 2424, "using_lmtp": true, "family": "A", "bind_helo": "my.draglabs.com" }, "bounced_rcpt": [ { "original": "<user@serverB.com>", "original_host": "serverB.com", "host": "serverB.com", "user": "user", "reason": "550 5.1.1 <user@serverB.com> User doesn't exist: user@serverB.com", "dsn_action": "failed", "dsn_smtp_code": "550", "dsn_smtp_extc": "5.1.1", "dsn_status": "5.1.1", "dsn_smtp_response": "<user@serverB.com> User doesn't exist: user@serverB.com", "dsn_remote_mta": "127.0.0.1" } ] }
What I think is happening is that because I enabled email on Server A, Server A is automatically looking for that user's email inbox to drop the email as opposed to routing it though the internet where is would use the MX records listed in the DNS.
So the question becomes how do you log into an email server without enabling inbound email.
Or how do you convince cloudron to be happy sending email from a different subdomain? like mail.serverb.com without setting the root of server be to my.mail.serverb.com
yes confirmed
I did some tests and they way it is configured now I can email anyone other than <user>@DomainB.com and if I disable "Incoming Email" then the server A user "relay@serverB.com" cannot authenticate for the purpose of sending emails.