[pbs-devel] [PATCH proxmox-backup 3/4] server: use configured email-from for sending mail

Dominik Csapak d.csapak at proxmox.com
Thu Dec 16 10:59:23 CET 2021


comment inline

On 12/14/21 13:44, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
>   src/server/email_notifications.rs | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/server/email_notifications.rs b/src/server/email_notifications.rs
> index 1e7650b0..0dc0cba5 100644
> --- a/src/server/email_notifications.rs
> +++ b/src/server/email_notifications.rs
> @@ -235,6 +235,10 @@ fn send_job_status_mail(
>       text: &str,
>   ) -> Result<(), Error> {
>   
> +    let _lock = crate::config::node::lock()?;
if you only read from the config, you do not need to lock it

we normally atomically replace the config on change, so a read
should always result in a valid config


> +    let (config, _) = crate::config::node::config()?;
> +    let from = config.email_from;
> +
>       // Note: OX has serious problems displaying text mails,
>       // so we include html as well
>       let html = format!("<html><body><pre>\n{}\n<pre>", handlebars::html_escape(text));
> @@ -248,7 +252,7 @@ fn send_job_status_mail(
>           &subject,
>           Some(&text),
>           Some(&html),
> -        None,
> +        from.as_deref(),
>           Some(&author),
>       )?;
>   






More information about the pbs-devel mailing list