Puppet Class: mailcatcher

Defined in:
puppet/modules/mailcatcher/manifests/init.pp

Overview

Class: mailcatcher

Installs Mailcatcher for viewing email sent from within the vm. Inbox should be visible at: localhost:1080/

To simplfy usage, a mailcatcher service has been added so the standard `sudo service mailcatcher start|stop|status` calls are available.

Note: Currently PHP(sendmail) and postfix messages are captured. For help configuring other backends see github.com/sj26/mailcatcher#how

[View source]

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'puppet/modules/mailcatcher/manifests/init.pp', line 13

class mailcatcher {

    include ::postfix
    include ::ruby

    # install sqlite
    require_package('libsqlite3-dev')

    # install mailcatcher
    package {'mailcatcher':
        ensure   => 'installed',
        provider => 'gem'
    }

    # add mailcatcher service
    systemd::service { 'mailcatcher':
      ensure  => present,
      require => Package['mailcatcher'],
    }

    # add php config
    php::ini { 'mailcatcher':
      settings => {
          'sendmail_path' => '/usr/bin/env catchmail -f some@from.address'
      },
      require  => Package['mailcatcher'],
    }

    # redirect postfix messages to mailcatcher
    File<|title == '/etc/postfix/transport'|> {
      content => template('mailcatcher/postfix.transport.erb'),
      owner   => 'root',
      group   => 'root',
      mode    => '0444',
      require  => Package['mailcatcher']
    }

}