Postfix configurations: sendmail only (simple): Difference between revisions
From wikinotes
(→Usage) |
No edit summary |
||
(3 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 16: | Line 21: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# /etc/periodic.conf | # /etc/periodic.conf (create) | ||
daily_clean_hoststat_enable="NO" | daily_clean_hoststat_enable="NO" | ||
Line 25: | Line 30: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# create mailer.conf, replace sendmail with postfix-sendmail | |||
mkdir -p /usr/local/etc/mail | mkdir -p /usr/local/etc/mail | ||
install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf | install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf | ||
Line 40: | 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 postfixAs 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 -tUsing Params (less useful)
echo 'my body' | sendmail \ -f noreply `# ${user}@domain.com (rc.conf hostname, and .localdomain)` \ -F 'No Reply' `# sender name` \