Merge pull request #565 from TinfoilSubmarine/feature/mail-from
add mail-from option
This commit is contained in:
commit
4008ccfa2d
3 changed files with 12 additions and 0 deletions
|
@ -5,6 +5,11 @@ repository history](https://github.com/ddclient/ddclient/commits/main).
|
|||
|
||||
## v4.0.0-rc.2 (unreleased work-in-progress)
|
||||
|
||||
### New features
|
||||
|
||||
* New `--mail-from` option to control the "From:" header of email messages.
|
||||
[#565](https://github.com/ddclient/ddclient/pull/565)
|
||||
|
||||
## 2024-12-25 v4.0.0-rc.1
|
||||
|
||||
### Breaking changes
|
||||
|
|
|
@ -25,6 +25,9 @@ daemon=300 # check every 300 seconds
|
|||
syslog=yes # log update msgs to syslog
|
||||
mail=root # mail all msgs to root
|
||||
mail-failure=root # mail failed update msgs to root
|
||||
# mail-from=root # set the email "From:" header to "root". If
|
||||
# unset (the default) or empty, the from address
|
||||
# depends on your system's default behavior.
|
||||
pid=@runstatedir@/ddclient.pid # record PID in file.
|
||||
# postscript=script # run script after updating. The new IP is
|
||||
# added as argument.
|
||||
|
|
|
@ -704,6 +704,7 @@ our %cfgvars = (
|
|||
'priority' => setv(T_STRING,0, 'notice', undef),
|
||||
'mail' => setv(T_EMAIL, 0, undef, undef),
|
||||
'mail-failure' => setv(T_EMAIL, 0, undef, undef),
|
||||
'mail-from' => setv(T_EMAIL, 0, undef, undef),
|
||||
'max-warn' => setv(T_NUMBER,0, 1, undef),
|
||||
|
||||
'exec' => setv(T_BOOL, 0, 1, undef),
|
||||
|
@ -1427,6 +1428,7 @@ my @opt = (
|
|||
["max-warn", "=i", "--max-warn=<max> : log at most <max> warning messages for undefined IP address"],
|
||||
["mail", "=s", "--mail=<address> : e-mail messages to <address>"],
|
||||
["mail-failure", "=s", "--mail-failure=<addr> : e-mail messages for failed updates to <addr>"],
|
||||
["mail-from", "=s", '--mail-from=<addr> : set the "From:" header in e-mail messages to <addr> if non-empty'],
|
||||
["exec", "!", "--{no}exec : do {not} execute; just show what would be done"],
|
||||
["debug", "!", "--{no}debug : print {no} debugging information"],
|
||||
["verbose", "!", "--{no}verbose : print {no} verbose information"],
|
||||
|
@ -2404,8 +2406,10 @@ sub sendmail {
|
|||
$recipients = opt('mail-failure');
|
||||
}
|
||||
if ($emailbody && $recipients && $emailbody ne $last_emailbody) {
|
||||
my $sender = opt('mail-from') // '';
|
||||
pipecmd("sendmail -oi $recipients",
|
||||
"To: $recipients",
|
||||
$sender ne '' ? ("From: $sender") : (),
|
||||
"Subject: status report from $program\@$hostname",
|
||||
"\r\n",
|
||||
$emailbody,
|
||||
|
|
Loading…
Reference in a new issue