Thanks meny time for your answer

Please i need little more help, friedly ask for little help to recieve any
feedback from following request.
Think possible here mailbox_domain will have been used a few times, but on
me setup I am not so successful.

root@mail:/etc/postfix# cat mysql-virtual_mailbox_domains.cf
user = username
password = StrongPassword
dbname = postfixadmin
hosts = localhost
query = SELECT domain FROM domain WHERE domain = '%s'

--

MariaDB [(none)]> use postfixadmin;
Database changed

MariaDB [postfixadmin]> SELECT domain FROM domain WHERE domain = '%s';
Empty set (0.000 sec)

MariaDB [postfixadmin]> SELECT domain FROM domain WHERE domain = '%s%';
Empty set (0.000 sec)

MariaDB [postfixadmin]> SELECT domain FROM domain;
+-------------------+
| domain        |
+-------------------+
| ALL           |
| example.ch    |
+-------------------+
2 rows in set (0.001 sec)

Thanks Regards
Mauri




-----Ursprüngliche Nachricht-----
Von: owner-postfix-us...@postfix.org <owner-postfix-us...@postfix.org> Im
Auftrag von post...@ptld.com
Gesendet: Dienstag, 18. Mai 2021 15:53
An: postfix-users@postfix.org
Betreff: Re: mysql entry needed?

On 05-18-2021 9:31 am, Maurizio Caloro wrote:
> Installed Mysql on debian 10.9 and will ask you friendly to receive 
> the
> 5
> command to create this db on my mysql sever.
> 
> Please I don't know the command's and I don't found or see any nice 
> example.

Postfix wont have any examples because it is something you do in sql/mysql,
there are many ways, and each database does it different. 
They assume you know how to use databases.

MySql documentation can be found here:
https://dev.mysql.com/doc/refman/8.0/en/creating-tables.html

But you can google more friendly examples, for example:
https://www.w3schools.com/mysql/mysql_create_table.asp

You have to first decide your table structure, only you will know everything
you will want in the database. Setting up databases with postfix is not for
the casual tutorial copy/paste development.


> virtual_mailbox_domains =        mysql:
> /etc/postfix/mysql-virtual_mailbox_domains.cf
> 
> mysql-virtual_mailbox_domains.cf
>                 username, password, DBName, host
>                 SELECT domain FROM domain WHERE domain = '%s'

Here is an example of one way for your setup:

main.cf:
virtual_mailbox_domains =
mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf

mysql-virtual_mailbox_domains.cf:
hosts = unix:/var/lib/mysql/mysql.sock
dbname = <your database name>
user = <db user name>
password = <password>
require_result_set = no
query = SELECT domainName FROM domains WHERE domainName='%s' LIMIT 1

MySQL Commands:
CREATE DATABASE <your database name>;
CREATE TABLE domains (domainName VARCHAR(50) NOT NULL PRIMARY KEY); INSERT
INTO domains SET domainName = 'example.com';


Reply via email to