fixup! add mail-from option
factor out duplicate code
This commit is contained in:
parent
2de77f17f7
commit
d1f81dc9e4
1 changed files with 10 additions and 22 deletions
32
ddclient.in
32
ddclient.in
|
@ -2407,28 +2407,16 @@ sub sendmail {
|
|||
$recipients = opt('mail-failure');
|
||||
}
|
||||
if ($emailbody && $recipients && $emailbody ne $last_emailbody) {
|
||||
if ($sender) {
|
||||
pipecmd("sendmail -oi $recipients",
|
||||
"To: $recipients",
|
||||
"From: $sender",
|
||||
"Subject: status report from $program\@$hostname",
|
||||
"\r\n",
|
||||
$emailbody,
|
||||
"",
|
||||
"-- ", # https://en.wikipedia.org/wiki/Signature_block#Standard_delimiter
|
||||
" $program\@$hostname (version $version)"
|
||||
);
|
||||
} else {
|
||||
pipecmd("sendmail -oi $recipients",
|
||||
"To: $recipients",
|
||||
"Subject: status report from $program\@$hostname",
|
||||
"\r\n",
|
||||
$emailbody,
|
||||
"",
|
||||
"-- ", # https://en.wikipedia.org/wiki/Signature_block#Standard_delimiter
|
||||
" $program\@$hostname (version $version)"
|
||||
);
|
||||
}
|
||||
pipecmd("sendmail -oi $recipients",
|
||||
"To: $recipients",
|
||||
$sender ne '' ? ("From: $sender") : (),
|
||||
"Subject: status report from $program\@$hostname",
|
||||
"\r\n",
|
||||
$emailbody,
|
||||
"",
|
||||
"-- ", # https://en.wikipedia.org/wiki/Signature_block#Standard_delimiter
|
||||
" $program\@$hostname (version $version)"
|
||||
);
|
||||
}
|
||||
$last_emailbody = $emailbody;
|
||||
$emailbody = '';
|
||||
|
|
Loading…
Reference in a new issue