You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Gitouche 59b11898e4
Fix molecule
4 weeks ago
defaults bump msmtp-1.8.23-1 (fix) 1 month ago
files Remove msmtp-1.8.19-1 files 8 months ago
handlers fix handler 2 years ago
meta Molecule fix 1 year ago
molecule/default Fix molecule 4 weeks ago
tasks fix group 4 weeks ago
templates Convert to RHEL support 2 years ago
tests Enable test mail by default; disable on travis 5 years ago
vars yamllint + ansible-lint 2 years ago
.ansible-lint Fix molecule - hopefully 1 year ago
.gitignore bump msmtp-1.8.23-1 2 months ago
LICENSE Update meta and readme 5 years ago Fix doc 8 months ago script de build rpm - moins de hardcoding 4 weeks ago

Build Status


This ansible role deploys msmtp as a mailer for RHEL8 and compatible.


  • Access to a functioning SMTP server.

How to install

  • Either use git to clone/download into your roles directory:
    • git clone
  • Or import in your requirements.yml:
      - src: git+


All the default variables are located defaults/main.yml. Mostly you would need to configure the following variables.

  • msmtp_accounts: You can define one or more smtp accounts:

    - account:   gmail
      port:      587
      auth:      "on"
      from:      example@gmail.example
      user:      example@gmail.example
      password:  "some password"
    - account:   mysmtp
      host:      smtp.example
      port:      587
      auth:      "on"
      password:  plain-text-password2
  • msmtp_default_account: Default smtp account to use

    msmtp_default_account: "gmail"

  • Logging

    • Option A (syslog)

       msmtp_log : "syslog"
    • Option B (file logging)

       msmtp_log     : "file"
       msmtp_logfile : /var/log/msmtp.log
    • Option C (No logging)

       msmtp_log     : "no"
  • Mail aliases

    • msmtp_alias_default: default email this required

      msmtp_alias_default :

    • msmtp_alias_root: root email this is optional

      msmtp_alias_root :

    • msmtp_alias_cron: cron email this optional

      msmtp_alias_cron :


You can configure your variables in ansible with one of the following

  • Create a variable in host/group variables directory.
  • Editing vars/main.yml
  • Run ansible-playbook with -e
  • Edit the defaults/main.yml (not recommended)

Example Playbook

- hosts: all
    - ansible-msmtp-mailer


  • mstmp used to function out of the box with the provided defaults/main.yml settings, because the configuration used a real smtp server for testing, but Yandex does not allow this any more. Instead use a Gmail account for testing.

    ansible-playbook -l hostname msmtp.yml


You should get a test mail if it works as expected on the root mail


msmtp manual



  • Apache 2.0