Rruonline
- Nov 4, 2024
- Joined Apr 24, 2023
- 6 discussions
- 16 posts
- 1 best answer
- Post posted... wait what? You got the answer!
Hi guys, I was just wondering if anyone knows how to set up some kind of user friendly email delivery reports for mailcow?
Sometimes a client will be having an email delivery problem, and I have to hunt through the postfix logs to try and figure out if the email in question ever arrived, and what happened to it
cPanel and DirectAdmin have a really neat GUI area where you can easily see a history of recent emails sent from/to a domain, and see at a glance any error details etc.
Thanks
Oh awesome, thanks for that!
- Edited
I recently disabled ipv6 on my mailcow server using this guide (), and it seemed to work fine, but now I want to undo my changes and re-enable ipv6.
I’m pretty confident I could undo the changes I made to the conf and yml files from steps 1-4 of this guide, but step 5 was to run the “sed” command and change a bunch of conf files blindly.
Does anyone know where I could find originals of these files to replace the sedded ones, and is this the safest way to achieve my goal?
Thanks.
Update - I figured out that I can change the default quarantine notification settings NEW mailboxes by editing the file ./data/web/inc/vars.inc.php
But I’m still stuck bulk trying to edit all my existing mailboxes - does anyone know if this is possible through the API?
- Edited
Thanks for sharing @rallisf1 , this is awesome, I’ve been looking for this exact thing.
One question: I don’t have DNS records for ALL my client domains set up pointing mail.clientdomain.com to my mailcow server, so I think your script would break autodiscover for these clients. Instead, I’d like autodiscover to first check if mail.clientdomain.com resolves to my mailcow server correctly (/check if SSL cert is valid for mail.clientdomaim.com?), and if not, use the standard mailcow.servername.tld as a fallback for autodiscover instead.
Think this is do-able, using your existing script as a starting point?
Or better yet, maybe the script could do an MX lookup on the domain in question, and match autodiscover to the (primary) MX record, whether that’s mail.clientdomain.com or mailcow.server.tld for each domain.
I’ve been able to use the mailcow API to change the quarantine notification frequency from the default “hourly” to “weekly” for a bulk batch of mailboxes, but I don’t see any endpoint that will let me change the quarantine category from “rejected” to “junk folder” or “all”.
Does anyone know if this is possible?
Hi, I’d also love to hear any developments on this.
At the moment I’ve got a setup that I think is pretty close to being redundant: I have 2 VPS’s running mailcow, with CloudFlare managing the DNS for my domain. The primary server (mail.mydomain.com) uses the cold-standby backup script (/opt/mailcow-dockerized/create_cold_standby.sh) to create/update a mirror image onto the 2nd VPS every hour (1 line cron job). It uses rsync, so doesn’t seem to transfer much data each time it does this.
So my cold-standby server is always ready to roll, and is only ever an hour out of date, so if my primary server ever has a major crash, I can switch the A record for mail.mydomain.com over to the IP address of the cold-standby server and boom, my clients can continue using their emails straight away, as though nothing is wrong (there’ll be a few emails missing that arrived in that last hour).
I also use the other backup script (helper-scripts/backup_and_restore.sh) to send a daily backup of my primary server to my Google Drive, and I keep a couple of days’ worth of these, just in case my cold-standby server has an issue.
I still need to figure out how I’m going to retrieve and restore those missing emails from that 1-hour gap, once I recover the data from my primary server again.
I’m also toying with setting up a backup MX server, but it would take a bit of tweaking to keep it updated with the list of domains/mailboxes/spam rules from the primary server, so I’ll worry about that later.
Does anyone have any opinions/improvements/suggestions on this setup? Should I run my cold-standby cron job every 5 minutes, or at some point of frequency will this cause issues (5 minutes/1 minute)?
- Edited
Hi, I’ve set up my new mailcow server using Sendgrid as an SMTP relay for all Google domains (transport maps in system config –> routing).
.*google\.com smtp.sendgrid.net:587 apikey
This works great, but I need to add an extra fallback SMTP option when this SMTP relay fails (e.g. when I add a new domain but forget to verify that domain in Sendgrid). I just want the fallback to be Mailcow’s regular SMTP.
I’m trying to set up a transport map to do this, but I can’t seem to get it to work. I’ve been trying things like this:
.*google\.com smtp.sendgrid.net:587, localhost apikey
Is this possible in the Mailcow GUI, or will I need to do some meddling into the postfix config files? And in that case, does anyone have any pointers for me?
Oh wow, thanks for that @FreddleSpl0it . Low IQ problems
- Best Answerset by esackbauer
ruonline solved my own problem - I see it DOES show storage used in another column. Whoops
- Edited
Thanks @FreddleSpl0it ,
If I omit defquota completely, or set it to 0, I get the error message “defquota empty”.
But when I set defquota to ANY positive number, I get “mailbox_defquota_exceeds_mailbox_maxquota”The domain is set up correctly, and I can add mailboxes manually no problem (screenshot attached showing domain, with 5GB domain quota & 5GB max quota per mailbox)
Any help would be appreciated,
Here’s my python code:
#!/usr/bin/python3 import requests import json from pprint import pprint url = "https://mailcow.example.com/api/v1/add/domain" APIKey = "my-api-key" headers = { "Content-Type" : "application/json", "X-API-Key" : APIKey } email_local_part = "test123" domain = "ruonline-mailer.com.au" password = "my-password" data = { "local_part": email_local_part, "domain": domain, "defquota": 1, "quota": 1, "password": password, "password2": password, "active": "1", "tls_enforce_in": "1", "tls_enforce_out": "1" } print("data:") pprint(data) r = requests.post(url, json=data, headers=headers) print("API response:s") pprint(r.json())
And here are some sample outputs showing the API response:
data: {'active': '1', 'defquota': 0, 'domain': 'ruonline-mailer.com.au', 'local_part': 'test123', 'password': 'Mypassword12##', 'password2': 'Mypassword12##', 'quota': 0, 'tls_enforce_in': '1', 'tls_enforce_out': '1'} API response:s [{'log': ['mailbox', 'add', 'domain', {'active': '1', 'defquota': 0, 'domain': 'ruonline-mailer.com.au', 'local_part': 'test123', 'password': '*', 'password2': '*', 'quota': 0, 'tls_enforce_in': '1', 'tls_enforce_out': '1'}, None], 'msg': 'defquota_empty', 'type': 'danger'}]
data: {'active': '1', 'defquota': 1000, 'domain': 'ruonline-mailer.com.au', 'local_part': 'test123', 'password': 'Mypassword12##', 'password2': 'Mypassword12##', 'quota': 1000, 'tls_enforce_in': '1', 'tls_enforce_out': '1'} API response:s [{'log': ['mailbox', 'add', 'domain', {'active': '1', 'defquota': 1000, 'domain': 'ruonline-mailer.com.au', 'local_part': 'test123', 'password': '*', 'password2': '*', 'quota': 1000, 'tls_enforce_in': '1', 'tls_enforce_out': '1'}, None], 'msg': 'mailbox_defquota_exceeds_mailbox_maxquota', 'type': 'danger'}]
And a screenshot showing my domain config:
Also, I can’t add mailboxes with quota = zero, which would be ideal. Is this normal?
Hi, I’d like to be able to see how much storage each domain is using in total (i.e. total storage used by all mailboxes on the domain).
The Mailbox configuration page has a handy view showing Quota (i.e. storage used / total quota), but the domain config page has a “quota” column that seems to only show the total quota used by that domain’s mailboxes if al the mailboxes were full (i.e. it shows the sum of the quota of all the mailboxes on the domain).
This is problematic, especially because I generally set my mailbox quotas to zero, with the idea that I will manage storage space used at the domain level.
Is it possible to see how much actual storage space each domain is currently using? It would be handy info on this page.
I’ve set up a little python script to add domains to my mailcow server, which is working fine.
I’ve got a similar one to create new mailboxes, but I can’t make it work.
It keeps returning “danger” and “mailbox_defquota_exceeds_mailbox_maxquota”This error is incorrect, the domain is huge, and the mailbox quota tiny.
Does anyone else have this problem? Am I doing something wrong, or is it something about my server setup, or is it a bug with the API?