/
Setting up a localhost Postfix Jira virtual mail domain

Setting up a localhost Postfix Jira virtual mail domain

TOC

The docs

Assumptions

  • You are using an Ubuntu distro.

Installation

apt-get install postfix

Configuration

  1. Figure out your postfix user id

    cat /etc/passwd | grep postfix

    Yielding: postfix:x:114:129::/var/spool/postfix:/bin/false
    In this example, the userid of the postfix user is 114, see next.

  1. Modify /etc/postfix/main.cf
    Add the following to the end of the file:

    virtual_mailbox_base = /var/mail/vhosts virtual_mailbox_domains = jira.myco.net virtual_mailbox_maps = hash:/etc/postfix/vmailbox virtual_minimum_uid=100 virtual_uid_maps = static:114 virtual_gid_maps = static:114 virtual_alias_maps = hash:/etc/postfix/virtual
  2. Create /etc/postfix/virtual
    If you are setup as a sub-domain (eg subdom.myco.com), its possibly useful to route any mail to the actual domain to a real user, do this with the following

    @myco.net root
  3. Create /etc/postfix/vmailbox
    In order to support a common mailbox for all inbound Jira mail, create the file:

    @jira.myco.net jira.myco.net/shared/inbox
  4. Create postfix database files from the configuration files
    For each of the config files, and for every change to them the following has to be run from /etc/postfix:

    postmap <configfile>

    eg

    postmap vmailbox postmap virtual
  5. Restart postfix to take account of changes

    /etc/init.d/postfix restart
  6. Create the virtual mailbox folders

    sudo mkdir -p /var/mail/vhosts/jira.myco.net/shared chown -R postfix /var/mail/vhosts

Testing

  1. Ensure mail is installed:

    dpkg -l | grep mailutils

    If you come up empty:

    sudo apt-get install mailutils
  2. Start a new console monitoring the mail.info log for useful feedback

    tail /var/log/mail.info
  1. Send a test mail

    sudo mail -s "hello" test@jira.myco.net Cc: bla bla .

    You should see the following in the mail.info log:

    Sep 25 23:04:43 mypc postfix/cleanup[11799]: 18F956A0B: message-id=<20080925220443.18F956A0B@mypc> Sep 25 23:04:43 mypc postfix/qmgr[11784]: 18F956A0B: from=<root@mypc>, size=307, nrcpt=1 (queue active) Sep 25 23:04:43 mypc postfix/virtual[11801]: 18F956A0B: to=<test@jira.myco.net>, relay=virtual, delay=0.03, delays=0.02/0/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox) Sep 25 23:04:43 mypc postfix/qmgr[11784]: 18F956A0B: removed

    Check the virtual mailbox file:

    cat /var/mail/vhosts/jira.myco.net/shared/inbox

    to see:

    cat /var/mail/vhosts/jira.myco.net/shared/inbox From root@mypc Thu Sep 25 23:04:43 2008 Return-Path: <root@mypc> X-Original-To: test@jira.myco.net Delivered-To: test@jira.myco.net Received: by trippy (Postfix, from userid 0) id 18F956A0B; Thu, 25 Sep 2008 23:04:43 +0100 (BST) Subject: hello To: <test@jira.myco.net> X-Mailer: mail (GNU Mailutils 1.1) Message-Id: <20080925220443.18F956A0B@mypc> Date: Thu, 25 Sep 2008 23:04:43 +0100 (BST) From: root@mypc (root) bla bla

If you see this, so far so good. You have a virtual mailbox all configured. Great, but now what? Now you need to set-up a POP3 server like Dovecot, see Setting up a Dovecot POP3 server for retrieving Jira mail from a virtual mailbox.

Related content