diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example index 6911eec..4fef4e0 100644 --- a/duplicity-backup.conf.example +++ b/duplicity-backup.conf.example @@ -387,12 +387,21 @@ EMAIL_SUBJECT= EMAIL_FAILURE_ONLY="yes" # send e-mail only if there was an error while creating backup # command to use to send mail +# don't put any options here, as ${MAIL} is used to check if the command is available +# on the system and locate its binary MAIL="mailx" # default command for Linux mail #MAIL="mail" # for CentOS, if "mailx" fails try this one #MAIL="ssmtp" #MAIL="sendmail" #MAIL="msmtp" +# Array to pass additional options to the mail command +# the options will be passed immediately after the name of the mail command +# like this: ${MAIL} ${MAIL_OPTIONS[*]} ${other options} +MAIL_OPTIONS=() +# for example with mailx, you can set the server and port for sending mails like this +#MAIL_OPTIONS=(-S smtp="smtps://mailserver.example.com:587") + # You may specify a custom mail script instead. It will be called with # the following convention: # MAIL "SUBJECT OF MESSAGE" "TO EMAIL ADDRESS" "FROM EMAIL ADDRESS" diff --git a/duplicity-backup.sh b/duplicity-backup.sh index 5e122b2..01489b4 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -375,6 +375,7 @@ email_logfile() if [ ! -x "${MAILCMD}" ]; then echo -e "Email couldn't be sent. ${MAIL} not available." >> "${LOGFILE}" else + MAILCMD="${MAILCMD} ${MAIL_OPTIONS[*]}" EMAIL_SUBJECT=${EMAIL_SUBJECT:="duplicity-backup ${BACKUP_STATUS:-"ERROR"} [${HOSTNAME}] ${LOG_FILE}"} case ${MAIL} in ssmtp)