Koozali.org: home of the SME Server

Help needed with smtproutes

Offline holck

  • ****
  • 317
  • +1/-0
Help needed with smtproutes
« on: November 26, 2022, 04:43:46 PM »
As mentioned here https://forums.koozali.org/index.php/topic,54914.0.html, some email providers lately have been blocking emails from my server, because of problems with reverse dns for my ip address.

So I decided to subscribe to mailersend.com, and set up my own server to use this, using smtp-auth-proxy. And this works ... mostly.

mailersend.com won't allow me to deliver DMARC reports to other mail providers, because mailersend.com blocks email with *.xml.gz attachments.

Also, it seems a bit foolish to use mailersend.com for emails to e.g. google.com, as Google happily accepts emails directly from my server. So I've experimented a bit with the contents of /var/qmail/control/smtproutes.

My idea is to use something like this:

Code: [Select]
csjdanmark.dk:localhost:26
jubii.dk:localhost:26
mail.dk:localhost:26
pc.dk:localhost:26
privat.dk:localhost:26
stofanet.dk:localhost:26
webspeed.dk:localhost:26
yahoo.dk:localhost:26
youmail.dk:localhost:26
:localhost

Hoping that this would make qmail use mailersend.com for outgoing emails to a few, specific domains. And for all other domains just send the emails directly.

But apparently this leads to some sort of mail loop, where qmail continuously tries to send the emails in the queue.

Any suggestions?


Answering my own question - all it required was to delete the last line in /var/qmail/control/smtproutes. With this contents, emails to a few, specific domains are forwarded to the external smtp-server, everything else is sent directly to the receiver.

Code: [Select]
csjdanmark.dk:localhost:26
jubii.dk:localhost:26
mail.dk:localhost:26
pc.dk:localhost:26
privat.dk:localhost:26
stofanet.dk:localhost:26
webspeed.dk:localhost:26
yahoo.dk:localhost:26
youmail.dk:localhost:26
« Last Edit: December 03, 2022, 09:44:02 AM by holck »
......

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: Help needed with smtproutes
« Reply #1 on: December 05, 2022, 10:44:00 PM »
Can you add that somewhere on the wiki please?
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline holck

  • ****
  • 317
  • +1/-0
Re: Help needed with smtproutes
« Reply #2 on: December 12, 2022, 10:16:07 PM »
I'm sorry, but I don't know where in the wiki the info could it in, and I don't think I have access to update the wiki.

But here's a small summary:

If you want to use an external mail server to deliver mails to some domains, but use the built-in mail server for delivering mails to all other domains, you should:

1: In server manager choose "E-mail" under menu heading "Configuration"
2: Fill out the entries under "SMTP server": Address of the external mail server, and - if needed - the user id and password to use for getting access to the external mail server
3: If you need to use a special port (e.g. 587) on the external mail server:
Code: [Select]
/sbin/e-smith/db configuration setprop smtpauthproxy PeerPort 5874: It may be advisable to also do
Code: [Select]
/sbin/e-smith/db configuration setprop smtpauthproxy Debug enabledThis will show the communication with the external mail server, helping solve potential problems regarding login etc.
5: Create a custom-template for /var/qmail/control/smtproutes, e.g. the file /etc/e-smith/templates-custom/var/qmail/control/smtproutes/01custom with a content like this:
Code: [Select]
onedomain.com:localhost:26
anotherdomain.org:localhost:26
with one line for each domain, for which you want to use the external mail server
6:
Code: [Select]
signal-event email-update
......

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: Help needed with smtproutes
« Reply #3 on: December 13, 2022, 12:18:06 AM »
You are a member of the Wiki & Docs team.

Login with your forum login.

Ask us questiond on Rocket in the SME-Documentation channel.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation