declare BATCH mode before installing packages.

setting BATCH=yes means that the package will not ask any questions during the install process.  Case in point: mail/postfix

# /usr/sbin/pkg install -g -U -y mail/postfix
The following 1 packages will be installed:

        Installing postfix: 2.10.2,1

The installation will require 14 MB more space

0 B to be downloaded
Checking integrity... done
[1/1] Installing postfix-2.10.2,1...===> Creating users and/or groups.
Using existing group 'mail'.
Using existing group 'maildrop'.
Using existing group 'postfix'.
Using existing user 'postfix'.
Would you like to activate Postfix in /etc/mail/mailer.conf [n]?