#!/bin/bash mailer () { if ! [[ -z "$3" ]]; then local mailfrom="From: $3 " fi if ! [[ -z "$4" ]]; then local mailto="$4" elif [[ -z "$mailto" ]]; then local mailto="christian@betz.cc" fi echo -e "$1" | mailx -s "$2" --append="$mailfrom" $mailto &>/dev/null }