Skip to content

franco

My feedback

1 result found

  1. 10 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    franco supported this idea  · 
    An error occurred while saving the comment
    franco commented  · 

    I need to use virtual aliases for customers emails to receive emails on forwarded address and send emails from the application from their subdomain to users of the application.

    The configuration in Postfix is ok and functional at this moment but the wildcard subdomain is not registered in DNS records. So we cant send emails to users or send emails from users.

    The postfix configuration is like this:
    1- We create a database to store domains, subdomains and users with destination emails.

    CREATE TABLE `virtual_domains` (
    `id` int(11) NOT NULL auto_increment,
    `name` varchar(50) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    CREATE TABLE `virtual_users` (
    `id` int(11) NOT NULL auto_increment,
    `domain_id` int(11) NOT NULL,
    `password` varchar(106) NOT NULL,
    `email` varchar(100) NOT NULL,
    PRIMARY KEY (`id`),
    FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    CREATE TABLE `virtual_aliases` (
    `id` int(11) NOT NULL auto_increment,
    `domain_id` int(11) NOT NULL,
    `source` varchar(100) NOT NULL,
    `destination` varchar(100) NOT NULL,
    PRIMARY KEY (`id`),
    FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    2.- we create 3 files on postfix:

    mysql-virtual-domains.cf :
    user = postfix_user
    password = postfix_password
    hosts = 127.0.0.1
    dbname = postfix_db
    query = SELECT 1 FROM virtual_domains WHERE name='%s'

    mysql-virtual-mailboxes.cf :
    user = postfix_user
    password = postfix_password
    hosts = 127.0.0.1
    dbname = postfix_db
    query = SELECT 1 FROM virtual_users WHERE email='%s'

    mysql-virtual-aliases.cf :
    user = postfix_user
    password = postfix_password
    hosts = 127.0.0.1
    dbname = postfix_db
    query = SELECT destination FROM virtual_aliases WHERE source='%s'

    3.- we configure main.cf in postfix to read the emails and destination.

    virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailboxes.cf
    virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-aliases.cf

    Now we need to have the dns MX connection to send and receive emails from user@subdomain.domain.com

    It would be a greet idea to implement this as a wildcard email processing system.

    Thanks for reading and maybe implement this as soon as possible.

    Best regards

Feedback and Knowledge Base