From 46e113141bf47decdb5cc5143a30bc06ad1cf199 Mon Sep 17 00:00:00 2001 From: runout-at Date: Thu, 11 Jun 2026 23:32:20 +0200 Subject: [PATCH 1/3] add macro for REMOTE_SMTP_INTERFACE retrieve IPs for REMOTE_SMTP_INTERFACE from the database --- docs/debian-conf.d/main/00_vexim_listmacrosdefs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/debian-conf.d/main/00_vexim_listmacrosdefs b/docs/debian-conf.d/main/00_vexim_listmacrosdefs index abf82a84..74406ae1 100644 --- a/docs/debian-conf.d/main/00_vexim_listmacrosdefs +++ b/docs/debian-conf.d/main/00_vexim_listmacrosdefs @@ -91,3 +91,12 @@ CHECK_DATA_LOCAL_ACL_FILE = /etc/exim4/vexim-acl-check-content.conf # compact version of the report. If you tweak your template this way, you may # as well want to change the header name here. VEXIM_SPAM_REPORT_HEADER_NAME = X-Spam-Report + +# Set the IP which should be used for outgoing connections +# This feature makes it easy to use different IPs per domain. +VEXIM_OUTIP = SELECT DISTINCT out_ip FROM domains \ + WHERE domain = '${quote_mysql:$sender_address_domain}' \ + AND out_ip <> TRIM('') +# set IPs of the outgoing interface as default/fallback. This value should be changed! +OUTGOING_IP_DEFAULT = :: ; 127.0.0.1 +REMOTE_SMTP_INTERFACE = ${lookup mysql{VEXIM_OUTIP}{ <; $value }{ <; OUTGOING_IP_DEFAULT }} From 8948b045515e1b113eeb256f6096f91af1f69135 Mon Sep 17 00:00:00 2001 From: runout-at Date: Thu, 11 Jun 2026 23:35:19 +0200 Subject: [PATCH 2/3] add field out_ip add field out_ip for exim macro REMOTE_SMTP_INTERFACE --- setup/mysql.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/mysql.sql b/setup/mysql.sql index 86c12719..232398c2 100644 --- a/setup/mysql.sql +++ b/setup/mysql.sql @@ -54,6 +54,7 @@ CREATE TABLE `domains` ( `spamassassin` tinyint(1) NOT NULL DEFAULT '0', `sa_tag` smallint(5) unsigned NOT NULL DEFAULT '0', `sa_refuse` smallint(5) unsigned NOT NULL DEFAULT '0', + `out_ip` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`domain_id`), UNIQUE KEY `domain` (`domain`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; From e2b59c38b14b79137d3ee2f4a56a10ae6d9e0dce Mon Sep 17 00:00:00 2001 From: runout-at Date: Thu, 11 Jun 2026 23:36:55 +0200 Subject: [PATCH 3/3] add field out_ip add field out_ip for exim macro REMOTE_SMTP_INTERFACE --- setup/pgsql.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/pgsql.sql b/setup/pgsql.sql index bc5151b8..f02ba968 100644 --- a/setup/pgsql.sql +++ b/setup/pgsql.sql @@ -61,7 +61,8 @@ CREATE TABLE "domains" ( "pipe" smallint NOT NULL default '0' CHECK("pipe" BETWEEN 0 AND 1), "spamassassin" smallint NOT NULL default '0' CHECK("spamassassin" BETWEEN 0 AND 1), "sa_tag" int NOT NULL default '0' CHECK("sa_tag" > -1), - "sa_refuse" int NOT NULL default '0' CHECK("sa_refuse" > -1)); + "sa_refuse" int NOT NULL default '0' CHECK("sa_refuse" > -1)), + "out_ip" varchar(255) NOT NULL default ''; ALTER TABLE "domains" OWNER TO vexim; --