Skip to content

Commit

Permalink
Adding rewritedomain and fromlineoverride options.
Browse files Browse the repository at this point in the history
  • Loading branch information
socket-es committed Oct 1, 2016
1 parent 6bcad0e commit 750d2d7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class { 'ssmtp':

`$port` can be used to specify which port to connect to on the mail hub (default: 25).
`$hostname` can be used to override the name of the local machine.
`$rewritedomain` can be used to where will the mail seem to come from.
`$fromlineoverride` if YES use address in the "from line" of the envelope.
`$usessl` if set to true then SSL will be used when connecting to the mail hub (default: false). This will
also set the default port to 465 unless `$port` is specified.
`$usetls` if set to true then TLS will be used when connecting to the mail hub (default: false).
Expand Down
16 changes: 9 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

class ssmtp (
$root,
$mailhub = 'mail',
$port = undef,
$hostname = undef,
$usessl = false,
$usetls = false,
$usetlscert = false,
$tlscert = undef) {
$mailhub = 'mail',
$port = undef,
$rewritedomain = undef,
$hostname = undef,
$fromlineoverride = undef,
$usessl = false,
$usetls = false,
$usetlscert = false,
$tlscert = undef) {

include ssmtp::params

Expand Down
23 changes: 23 additions & 0 deletions templates/ssmtp.conf.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
# This file is automatically generated by Puppet
#
# Any changes made to this file will be lost on the next automated Puppet run!
#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#

# The person who gets all mail for user IDs < 1000
# Make this empty to disable rewriting.
root=<%= @root %>

# The place where the mail goes
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=<%= @_mailhub %>

# Example for SMTP port number 2525
# mailhub=mail.your.domain:2525
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain
# Example for SSL encrypted connection
# mailhub=mail.your.domain:465

<% if @rewritedomain -%>
# Where will the mail seem to come from?
rewriteDomain=<%= @rewritedomain %>
<% end -%>

# The full hostname
hostname=<%= @fqdn %>

<% if @fromlineoverride -%>
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
FromLineOverride=<%= @fromlineoverride %>
<% end -%>

<% if @usetls == true -%>
# Send STARTTLS to remote host after connection
UseTLS=YES
Expand Down

0 comments on commit 750d2d7

Please sign in to comment.