dgibbs64.postfix_send_only_relay

postfix_send_only_relay

An Ansible role that installs Postfix and sets it up to send emails only through an SMTP relay.

Codacy grade GitHub Workflow Status GitHub tag (latest by date) MIT License

About

This role is for servers that will only send emails, not receive them. It's helpful for getting emails from cron jobs or other services that send emails.

Requirements

You need an SMTP relay service.

Your email provider might have a service for this. If not, there are many popular SMTP relays that offer free options.

Service Free Tier Email Limit Docs
Mailjet 6000 per month, 200 per day link
Sendgrid 3000 per month, 100 per day link

Supported Distros

  • AlmaLinux >= 8
  • AmazonLinux 2023
  • CentOS >= 7
  • Debian >= 10
  • Fedora >= 37
  • openSUSE >= 15.4
  • OracleLinux >= 8
  • Pop!_OS >= 18.04
  • Redhat Enterprise Linux >= 8
  • Rocky Linux >= 8
  • Ubuntu >= 18.04

Role Variables

---
# Path for postfix configuration
postfix_config_file: "/etc/postfix/main.cf"

# The domain used for sending emails.
postfix_mydomain:

# The domain used for sending emails if none is specified; usually the same as mydomain or myhostname.
postfix_myorigin: "$mydomain"

# mydestination controls which domains postfix considers as final destinations.
## With aliases set, postfix processes the email to forward it using /etc/aliases.
## Example: root -> postfix -> [email protected] -> aliases -> [email protected] -> relayhost -> [email protected]
postfix_mydestination: "$myhostname, localhost.$mydomain, localhost, $mydomain"
## If no aliases are needed, localhost only will forward emails without further processing.
## Example: root -> postfix -> [email protected] -> relayhost -> [email protected]
# postfix_mydestination: "localhost"

# Interfaces allowed to send emails; loopback-only allows only localhost.
postfix_inet_interfaces: "loopback-only"

# SMTP relay host.
postfix_relayhost:

# Username for SMTP server.
postfix_sasl_username:
# Password for SMTP server.
postfix_sasl_password:

# The domain used by the mail command.
postfix_mail_send_domain: "{{ postfix_mydomain }}"

# Email address to receive all emails sent to the root user of the server.
postfix_root_alias:

# Email address to get a test email when the role runs.
postfix_test_send_email:

Dependencies

community.general

Example Playbook

---
- name: Linux Admin Packages
  hosts: all
  vars:
    postfix_mydomain: "example.com"
    postfix_relayhost: "[in-v3.mailjet.com]:587"
    postfix_sasl_username: "username"
    postfix_sasl_password: "password"
    postfix_root_alias: "[email protected]"
  roles:
    - role: "dgibbs64.postfix_send_only_relay"

License

MIT

Author Information

Informazioni sul progetto

An Ansible role to install Postfix and configure as send-only via an SMTP relay.

Installa
ansible-galaxy install dgibbs64.postfix_send_only_relay
Licenza
mit
Download
868
Proprietario
🎮 Developer of LinuxGSM. 💻 Platform Engineer.⚓️ Ex Royal Navy Engineer