diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 418ef0612ba..f87bafb513d 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -512,7 +512,7 @@ class CMailFile // Give the message a subject try { - $result = $this->message->setSubject($this->subject); + $this->message->setSubject($this->subject); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } @@ -557,6 +557,14 @@ class CMailFile } } + if (!empty($this->errors_to)) { + try { + $this->message->setReturnPath($this->getArrayAddress($this->errors_to)); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + } + } + try { $this->message->setCharSet($conf->file->character_set_client); } catch (Exception $e) {