Skip to content

Per-domain SMTP gateway (smart-host) configuration - #102

Open
gott-alexander wants to merge 2 commits into
grommunio:masterfrom
gott-alexander:feature/per-domain-smtp-gateway
Open

gott-alexander wants to merge 2 commits into
grommunio:masterfrom
gott-alexander:feature/per-domain-smtp-gateway

Conversation

@gott-alexander

@gott-alexander gott-alexander commented Sep 17, 2026 •

Copy link
Copy Markdown

Adds the grommunio-admin API surface for the per-domain SMTP-gateway table that gromox reads at SMTP delivery time.

Changes:

  • New SQL migration sql/001-domain-smtp-gateway.sql that creates the domain_smtp_gateway table (one row per domain) and an index on enabled. Compatible with MariaDB 10.5+ and MySQL 8+.
  • New ORM model orm.domain_smtp_gateway.DomainSmtpGateway registered in orm/__init__.py.
  • New REST endpoint mounted at
    GET /api/v1/domains/<id>/smtpGateway
    PUT /api/v1/domains/<id>/smtpGateway
    DELETE /api/v1/domains/<id>/smtpGateway
    The endpoint re-emits the gromox config-reload signal so the
    lookup table is picked up without restarting the daemons.
  • New CLI subcommand
    grommunio-admin domain smtp-gateway {set,show,delete,list}
    for headless configuration. Passwords are masked in show and
    list output.
  • OpenAPI 3 spec updated: /domains/{domainID}/smtpGateway path,
    domainSmtpGateway / domainSmtpGatewayWrite schemas.
  • res/openapi.json regenerated from openapi.yaml.

Companion changes: grommunio/gromox# (service registry + cu_send_mail integration) and grommunio/admin-web# (SMTP-gateway tab in the domain details).

Now, all in one commit

Adds the grommunio-admin API surface for the per-domain SMTP-gateway
table that gromox reads at SMTP delivery time.

Changes:

  * New SQL migration `sql/001-domain-smtp-gateway.sql` that creates
    the `domain_smtp_gateway` table (one row per domain) and an
    index on `enabled`. Compatible with MariaDB 10.5+ and MySQL 8+.
  * New ORM model `orm.domain_smtp_gateway.DomainSmtpGateway`
    registered in `orm/__init__.py`.
  * New REST endpoint mounted at
    `GET    /api/v1/domains/<id>/smtpGateway`
    `PUT    /api/v1/domains/<id>/smtpGateway`
    `DELETE /api/v1/domains/<id>/smtpGateway`
    The endpoint re-emits the gromox config-reload signal so the
    lookup table is picked up without restarting the daemons.
  * New CLI subcommand
    `grommunio-admin domain smtp-gateway {set,show,delete,list}`
    for headless configuration. Passwords are masked in `show` and
    `list` output.
  * OpenAPI 3 spec updated: `/domains/{domainID}/smtpGateway` path,
    `domainSmtpGateway` / `domainSmtpGatewayWrite` schemas.
  * `res/openapi.json` regenerated from `openapi.yaml`.

Companion changes: grommunio/gromox#<PR> (service registry +
`cu_send_mail` integration) and grommunio/admin-web#<PR>
(SMTP-gateway tab in the domain details).
Comment thread endpoints/domain/smtp_gateway.py Outdated
if not data.get("password"):
# Keep the existing password if the form submits an empty
# field (common UX for password fields).
data.pop("password", None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a default value if we don't save the return value


from orm import DB
try:
if gw not in DB.session:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.....can this even be true?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants