
your hotmail or gmail account) send an e-mail to or whatever your domain is and watch the log file. NOTE: You can stop and restart postfix with service postfix stop and service postfix restart or reload the configuration files with service postfix reload.įrom another domain (e.g. Nov 6 17:57:04 configuration /usr/local/etc/postfixĬheck if postfix runs and listens on port 25. Nov 6 17:57:04 www postfix/postfix-script: starting the Postfix mail system In my case I saw these lines in the log file. Postfix can be started with: service postfix startĬheck the log file with: tail /var/log/maillog NOTE: You should execute these lines anytime you make a change to these files. Once we are done with editing these files, do the following to create the hashed files (extension. We’ll be dealing with Berkeley DB.Ĭreate the virtual aliases file and create a local aliases file. Check the postfix howto if you want to use mySQL or PostgreSQL. Postfix can use hash: (Berkeley-DB), mySQL or PostgreSQL database to store the e-mail accounts.

Maybe you’ve noticed that the file with the e-mail addresses (vmailbox) has a hash: prefix in the config file. It’s much easier to maintain one list of virtual users and hosts than deal with separate configuration files. If we want this OS user to receive an email, we’ll have to treat him as a virtual user and add him to a virtual domain. This line tells postfix to get all the emails for the non-existing users in that domain (), which means a lot of spam.īut what if you have a valid FreeBSD user named bill? Where that email goes? In this case, nowhere. If you want you can create a catch-all address, see the example above ( catch-all). Once everything is up and running, postfix will take care of creating the Maildir structure (cur, new, tmp). You don’t have to create these sub-directories. Virtual user “ ” (mind that there is no FreeBSD login for this user, these are all virtual users) will have his email delivered under /var/mail/vhosts//joe directory. NOTE: Make sure you end up each line with “/”, otherwise mail won’t be delivered. Finally, create a file /usr/local/etc/postfix/vmailbox and add all of the users that will receive e-mails. Once you do that, postfix will create the “Maildir” directories automatically and assign the proper permissions once an e-mail hits these destinations. This is where the mail will be stored for all virtual domains. # Put each domain in a separate line.Ĭreate the mail directory, sub-directories for the domains and assign the proper permissions. Of course, you’ll have to make sure that MX records of your domains point to the IP of the FreeBSD box. This is the file where all of your domains will be listed. Now, create a new file called /usr/local/etc/postfix/virtual_domains. Virtual_alias_maps = hash:/usr/local/etc/postfix/virtual # Make sure you replace these UID:GID numbers Virtual_mailbox_maps = hash:/usr/local/etc/postfix/vmailbox Virtual_mailbox_domains = /usr/local/etc/postfix/virtual_domains While editing main.cf, add these lines at the end of the file. Replace with whatever your FQDN of the server is. Now, edit main.cf and change the following values: myhostname = mydomain = vpostfix:*:1002:1001:Virtual Postfix user:/var/empty:/usr/sbin/nologin

In my case the output was this, which means the UID is 1002 and GID is 1001.

pw groupadd vpostfix & pw useradd vpostfix -g vpostfix -s /usr/sbin/nologin -c "Virtual Postfix user" -d /var/empty cd /usr/local/etc/postfixĬreate a user that will have access to the mailboxes and get its UID and GID. There are two main files, main.cf and master.cf. The configuration files for postfix are in /usr/local/etc/postfix. Say y, edit /etc/rc.conf and add these two lines to start postfix and dovecot automatically on boot. Would you like to activate Postfix in /etc/mail/nf ? You should accept the defaults for perl5, pcre, db5, gmake, gettext and dovecot2. The rest (dovecot, amavisd…) configs should be fine. If you want to use MySQL or PostgreSQL, the scenario below won’t apply for postfix. I am using Berkeley DB as a back-end database. OPTIONAL: Select TEST if you want to do a stress test (see below). Make sure that BDB, PCRE, TLS and DOVECOT2 are selected and INST_BASE is not selected.
#CENTOS SPAMASSASSIN INSTALL#
Try pkg install postfix-sasl instead and see if it works. NOTE: Recently, I got an e-mail saying that if you install the postfix-sasl package, you don’t have to deal with the ports. The packaged install doesn’t come up with some prerequisites. And will allow you to use virtual e-mail domains and users.įreeBSD comes with sendmail preinstalled, so we need to remove it first.
