Postfix configurations: sendmail only: Difference between revisions

From wikinotes
m (Will moved page Postfix example: sendmail only to Postfix configurations: sendmail only without leaving a redirect)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{ NOTE |
I believe this is both postfix and dovecot... }}
= Locations =
<blockquote>
{| class="wikitable"
|-
| <code>/etc/mail/mailer.conf</code> || ?
|-
|}
</blockquote><!-- Locations -->
= Install =
<blockquote>
== FreeBSD ==
<blockquote>
Install
<source lang="bash">
<source lang="bash">
sudo pkg install postfix
sudo pkg install postfix
Line 4: Line 22:
</source>
</source>


Add user postfix to group mail
<source lang="bash">
pw groupmod mail -m postfix
hostname            # Verify your hostname is an FQDN
sudo newaliases      # (Re) Aliases file (mail aliases)
</source>
Enable postfix, Replace <code>sendmail</code>
<syntaxhighlight lang="bash">
# /etc/rc.conf


/etc/rc.conf
<source lang="bash">
hostname="mercbugs.mfwbugs.com"  # required suffix of domain.com so that it looks like a FDQN (email will be from bugzilla@mfwbugs.com)
hostname="mercbugs.mfwbugs.com"  # required suffix of domain.com so that it looks like a FDQN (email will be from bugzilla@mfwbugs.com)
postfix_enable="YES"
postfix_enable="YES"
</source>
/usr/local/etc/postfix/main.cf
<source lang="bash">
mailbox_command = /usr/local/libexec/dovecot/deliver
smtpd_use_tls = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_path        = private/auth
smtpd_sasl_type        = dovecot
smtpd_recipient_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_destination
</source>


FreeBSD includes sendmail, which we will be replacing with postfix.
You can inform your system which executable to use in rc.conf/periodic.conf


/etc/rc.conf
# FreeBSD includes sendmail, which we will be replacing with postfix.
<source lang="bash">
# You can inform your system which executable to use in rc.conf/periodic.conf
#
# Disable Sendmail (for postfix)
# Disable Sendmail (for postfix)
sendmail_enable="NO"
sendmail_enable="NO"
Line 34: Line 45:
sendmail_outbound_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_enable="NO"
sendmail_msp_enable="NO"
</source>
</syntaxhighlight>
 
 
<syntaxhighlight lang="bash">
# /etc/periodic.conf


/etc/periodic.conf
<source lang="bash">
# It may need to be created
# It may need to be created
# Disable Unneeded Sendmail (using postfix)
# Disable Unneeded Sendmail (using postfix)
Line 44: Line 57:
daily_status_include_submit_mailq="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
daily_submit_queuerun="NO"
</source>
</syntaxhighlight>
</blockquote><!-- FreeBSD -->
</blockquote><!-- Install -->
 
= Configuration =
<blockquote>
== main.cf ==
<blockquote>
<syntaxhighlight lang="bash">
# /usr/local/etc/postfix/main.cf


Add user postfix to group mail
mailbox_command = /usr/local/libexec/dovecot/deliver
<source lang="bash">
smtpd_use_tls = no
pw groupmod mail -m postfix
smtpd_sasl_auth_enable = yes
hostname            # Verify your hostname is an FQDN
smtpd_sasl_path        = private/auth
sudo newaliases      # (Re) Aliases file (mail aliases)
smtpd_sasl_type        = dovecot
</source>
smtpd_recipient_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_destination
</syntaxhighlight>
</blockquote><!-- main.cf -->
</blockquote><!-- Configuration -->


<source lang="bash">
= Usage =
sudo service postfix start
<blockquote>
<syntaxhighlight lang="bash">
echo "Email Body" \
echo "Email Body" \
     | mail -s "Test Subject" you@domain.com
     | mail -s "Test Subject" you@domain.com
Line 60: Line 89:
# confirm email was sent
# confirm email was sent
tail -n 30 /var/log/maillog  # check for status=sent
tail -n 30 /var/log/maillog  # check for status=sent
</source>
</syntaxhighlight>
</blockquote><!-- Usage -->

Latest revision as of 05:34, 19 February 2022

NOTE:

I believe this is both postfix and dovecot...

Locations

/etc/mail/mailer.conf ?

Install

FreeBSD

Install

sudo pkg install postfix
#( when asked to activate postfix in /etc/mail/mailer.conf say YES )

Add user postfix to group mail

pw groupmod mail -m postfix
hostname             # Verify your hostname is an FQDN
sudo newaliases      # (Re) Aliases file (mail aliases)

Enable postfix, Replace sendmail

# /etc/rc.conf

hostname="mercbugs.mfwbugs.com"  # required suffix of domain.com so that it looks like a FDQN (email will be from bugzilla@mfwbugs.com)
postfix_enable="YES"


# FreeBSD includes sendmail, which we will be replacing with postfix.
# You can inform your system which executable to use in rc.conf/periodic.conf
#
# Disable Sendmail (for postfix)
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_enable="NO"


# /etc/periodic.conf

# It may need to be created
# Disable Unneeded Sendmail (using postfix)
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"

Configuration

main.cf

# /usr/local/etc/postfix/main.cf

mailbox_command = /usr/local/libexec/dovecot/deliver
smtpd_use_tls = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_path        = private/auth
smtpd_sasl_type        = dovecot
smtpd_recipient_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_destination

Usage

echo "Email Body" \
    | mail -s "Test Subject" you@domain.com

# confirm email was sent
tail -n 30 /var/log/maillog  # check for status=sent