Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Function to connect to SMTP and send mail to it
# returns:
# 0 - SUCCESS
# 1 - FAILURE: unable to complete session to DATA command
# 2 - FAILURE: problems after DATA command (server did not enqueue the message)
function bash_mail(){
# Default configuration
# Can be overridden by ARGV in order: TO, SUBJECT, MESSAGE, FROM, SERVER