Postfix configurations: sendmail only (simple)

From wikinotes

Ports

No incoming ports must be open to send emails.

Install

FreeBSD

sudo pkg install postfix

As directed by pkg

# /etc/rc.conf

postfix_enable="YES"
sendmail_enable="NONE"
# /etc/periodic.conf (create)

daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
# create mailer.conf, replace sendmail with postfix-sendmail
mkdir -p /usr/local/etc/mail
install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf
sudo reboot

Usage

Piping email with headers (best)

{
  echo From: noreply@domain.com
  echo To: you@gmail.com
  echo Subject: Foo Bar Baz
  echo
  echo This is my email.
  echo Hello friend!
} | sendmail -t

Using Params (less useful)

echo 'my body' | sendmail \
  -f noreply     `# ${user}@domain.com (rc.conf hostname, and .localdomain)` \
  -F 'No Reply'  `# sender name` \