Difference between revisions of "Sendmail omnios"

From Asenjo
Jump to: navigation, search
(install sendmail)
m
Line 8: Line 8:
 
by default omnios installs no mailer, so we need to install it:
 
by default omnios installs no mailer, so we need to install it:
  
<code><pre>
+
<pre>
 
# pkg install sendmail
 
# pkg install sendmail
 
           Packages to install:  1
 
           Packages to install:  1
Line 24: Line 24:
 
Package State Update Phase                      1/1
 
Package State Update Phase                      1/1
 
Image State Update Phase                        2/2
 
Image State Update Phase                        2/2
</pre></code>
+
</pre>
  
 
We need to enable it to have it start on boot, of course:
 
We need to enable it to have it start on boot, of course:
  
<code><pre>
+
<pre>
 
svcadm enable sendmail
 
svcadm enable sendmail
</pre></code>
+
</pre>
  
 
== configuration ==
 
== configuration ==
Line 37: Line 37:
 
The config dir in omnios for sendmail is /etc/mail/. The main config file is /etc/mail/sendmail.cf, but you must not edit this file directly. Instead, go to /etc/mail/cf/cf and copy the macro file main.mc to whatever.mc. This is my mc file:
 
The config dir in omnios for sendmail is /etc/mail/. The main config file is /etc/mail/sendmail.cf, but you must not edit this file directly. Instead, go to /etc/mail/cf/cf and copy the macro file main.mc to whatever.mc. This is my mc file:
  
<code><pre>
+
<pre>
 
divert(0)dnl
 
divert(0)dnl
 
VERSIONID(`sendmail.mc (Sun)')
 
VERSIONID(`sendmail.mc (Sun)')
Line 58: Line 58:
 
MAILER(`smtp')dnl
 
MAILER(`smtp')dnl
  
</pre></code>
+
</pre>
  
 
after that, compile the config file (from /etc/mail/cf/cf):
 
after that, compile the config file (from /etc/mail/cf/cf):
  
<code><pre>
+
<pre>
 
m4 ../m4/cf.m4 whatever.mc > whatever.cf
 
m4 ../m4/cf.m4 whatever.mc > whatever.cf
</pre></code>
+
</pre>
  
 
I will not explain the settings, you may buy the bat book to learn all you ever wanted to know about sendmail but were to shy to ask. Suffice to say, this works for me.
 
I will not explain the settings, you may buy the bat book to learn all you ever wanted to know about sendmail but were to shy to ask. Suffice to say, this works for me.
Line 74: Line 74:
 
we need to give root a decent from: address, so I make a genericstable file like this:
 
we need to give root a decent from: address, so I make a genericstable file like this:
  
<code><pre>
+
<pre>
 
root    user@domain.nl
 
root    user@domain.nl
</pre></code>
+
</pre>
  
 
and compile the database with  
 
and compile the database with  
  
<code><pre>
+
<pre>
 
makemap -r hash genericstable.db < genericstable
 
makemap -r hash genericstable.db < genericstable
</pre></code>
+
</pre>
  
 
=== copy config file ===
 
=== copy config file ===
 
copy the whatever.cf file we just compiled to /etc/mail/sendmail.cf and restart the sendmail daemon:
 
copy the whatever.cf file we just compiled to /etc/mail/sendmail.cf and restart the sendmail daemon:
  
<code><pre>
+
<pre>
 
svcadm refresh sendmail
 
svcadm refresh sendmail
</pre></code>
+
</pre>

Revision as of 13:40, 4 September 2015


in order to get e-mail notifications for whatever software you may use you need to install and configure sendmail (no kidding).

In my case I needed to relay through my provider, upc.nl. Their smarthost is smtp.upcmail.nl. Let's do it!

install sendmail

by default omnios installs no mailer, so we need to install it:

# pkg install sendmail
           Packages to install:  1
       Create boot environment: No
Create backup boot environment: No
            Services to change:  1

DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                  1/1     133/133      1.3/1.3

PHASE                                        ACTIONS
Install Phase                                205/205

PHASE                                          ITEMS
Package State Update Phase                       1/1
Image State Update Phase                         2/2

We need to enable it to have it start on boot, of course:

svcadm enable sendmail

configuration

we need to modify an mc file that will be used to 'compile' the configuration file using m4.

The config dir in omnios for sendmail is /etc/mail/. The main config file is /etc/mail/sendmail.cf, but you must not edit this file directly. Instead, go to /etc/mail/cf/cf and copy the macro file main.mc to whatever.mc. This is my mc file:

divert(0)dnl
VERSIONID(`sendmail.mc (Sun)')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
define(`SMART_HOST', `smtp.upcmail.nl')dnl
EXPOSED_USER(`root')dnl
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

FEATURE(always_add_domain)dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`allmasquerade')dnl
MASQUERADE_AS(`asenjo.nl')dnl
MASQUERADE_DOMAIN(`zone4.asenjo.nl.')dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl

MAILER(`smtp')dnl

after that, compile the config file (from /etc/mail/cf/cf):

m4 ../m4/cf.m4 whatever.mc > whatever.cf

I will not explain the settings, you may buy the bat book to learn all you ever wanted to know about sendmail but were to shy to ask. Suffice to say, this works for me.

masquerade addresses

upc.nl will not let me relay unless I say my from: address is something they like. So that is why I use the masquerading directives.

genericstable

we need to give root a decent from: address, so I make a genericstable file like this:

root    user@domain.nl

and compile the database with

makemap -r hash genericstable.db < genericstable

copy config file

copy the whatever.cf file we just compiled to /etc/mail/sendmail.cf and restart the sendmail daemon:

svcadm refresh sendmail