1

Topic: Problems using mysql for relaying via transport

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3 MYSQL edition.
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: Ubuntu 20.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,
I have a small problem with sending mails to some domains because I don't get rid of a barracuda-entry. So I've tried sending mails via a smtp service as a registered user for receivers where I get blocked by barracuda-service. This works fine, when I create a local file
    /etc/postfix/transport
with content
    domain1.tld1 smtp:SMTP-SERVICE:587
    domain2.tld2 smtp:SMTP-SERVICE:587
    domain3.tld3 smtp:SMTP-SERVICE:587
and execute
    sudo postmap /etc/postfix/transport && sudo systemctl postfix reload

sasl works fine with the account for the smtp-service.

Now I've created a MySQL-table vmail.transport and filled it with my receivers blocked by barracuda.
I've created the file
    /etc/postfix/mysql/transport_maps.cf
with following conten
    hosts          = 127.0.0.1:3306
    user           = vmail
    password    =<SECRET>
    dbname      = vmail
    query         = SELECT CONCAT(domain, " ", transport, ":", relaydomain, ":", port) as  transport_map
                FROM transport
                WHERE domain='%d' AND active=1
                LIMIT 1

The select brings me for each searched domain line a result like the entry in the textfile transport.

The file /etc/postfix/mysql/transport_maps.cf was activated in main.cf by adding
     proxy:mysql:/etc/postfix/mysql/transport_maps.cf
to transport_maps and postfix was reloaded.

But when I try to send a mail to a blocked address, the mail is not sent in the logfile I find

postfix/qmgr[912817]: warning: connect to transport private/DOMAIN.TLD smtp: No such file or directory
mail postfix/error[913790]: 4D19mq19nhz1prLv: to=<email@DOMAIN.TLD>, relay=none, delay=1081, delays=835/247/0/0.01, dsn=4.3.0, status=deferred (mail transport unavailable)

???

Does anyone has a hint for solving this problem?

Best regards
Max

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Problems using mysql for relaying via transport

malmax66 wrote:

    query         = SELECT CONCAT(domain, " ", transport, ":", relaydomain, ":", port) as  transport_map
                FROM transport
                WHERE domain='%d' AND active=1

Your SQL query should return something like "smtp:SMTP-SERVICE:587" (without quotes), not "domain.ltd smtp:SMTP-SERVICE:587".