Add a list to domains to Relay and Transports in bulk mode

DavidP

New Member
Jun 17, 2021
2
4
3
37
Hi,

We need to add lots of domains (almots 500 domains) to Relay configuration list and Transports (some of them with different ips).
There is a way to add this with command line?

We try adding the domains to /etc/pmg/domains, but its not working.

Any one can help us?

Regards

Edit: we found the way to add it to Relay, with this:

Previosly you need to generate the list in domains.txt

cat domains.txt| while read i; do pmgsh create /config/domains --domain $i; done

But still no idea how to do it in Transports.

Edit2:
For the Transports:

cat domains.txt| while read i; do pmgsh create /config/transport -domain $i -host <ip> -port 25 -protocol smtp -use_mx 1; done

And with that commads, you can add in bulk the domains.
 
Last edited:
We need to add lots of domains (almots 50 domains) to Relay configuration list and Transports (some of them with different ips).
There is a way to add this with command line?
You could use the REST API:
https://pmg.proxmox.com/pmg-docs/api-viewer/index.html#/config/domains
either using `pmgsh`
or via https to port 8006 - see the API documentation for Proxmox VE(which has a very similar api):
https://pve.proxmox.com/wiki/Proxmox_VE_API

That should be the safest way to get everything right

We try adding the domains to /etc/pmg/domains, but its not working.
usually this should work as well - did you run postmap afterwards and restart postfix?!
If yes - please share your logs - maybe we can find the root-cause

I hope this helps!
 
  • Like
Reactions: DavidP
Hi Stoiko,

We find how to do this.

For the Transport option:

You have to fill the file domains.txt

then execute:

cat domains.txt| while read i; do pmgsh create /config/transport -domain $i -host <ip> -port 25 -protocol smtp -use_mx 1; done


and for the Relay option:

cat domains.txt| while read i; do pmgsh create /config/domains --domain $i; done

Im going to edit the first post to add this, maybe it can be usefull for someone.

Regards
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!