Postfix configurations: sendmail only (simple): Difference between revisions

From wikinotes
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Ports =
<blockquote>
No incoming ports must be open to send emails.
</blockquote><!-- Ports -->
= Install =
= Install =
<blockquote>
<blockquote>
Line 41: Line 46:
   echo To: you@gmail.com
   echo To: you@gmail.com
   echo Subject: Foo Bar Baz
   echo Subject: Foo Bar Baz
  echo
  echo This is my email.
  echo Hello friend!
} | sendmail -t
} | sendmail -t
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 05:32, 19 February 2022

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` \