Hi,

You're right :-)

Maybe we could add an extra if in each branch? 
I attached the patch again with this idea (and with the "fullname" error
fixed).

Thanks for your work,
Mònica
--- moodlelib.php.ori	2010-08-24 21:25:20.000000000 +0200
+++ moodlelib.php	2011-01-29 18:42:49.000000000 +0100
@@ -4275,9 +4275,19 @@
     if (is_string($from)) { // So we can pass whatever we want if there is need
         $mail->From     = $CFG->noreplyaddress;
         $mail->FromName = $from;
+        // Set Reply-To header. Some mail servers override email address of From: header.
+        // Setting Reply-To header we avoid that user replies to the overriden address
+        if (empty($replyto)) {
+            $mail->AddReplyTo($CFG->noreplyaddress, $from);
+        }
     } else if ($usetrueaddress and $from->maildisplay) {
         $mail->From     = stripslashes($from->email);
         $mail->FromName = fullname($from);
+        // Set Reply-To header. Some mail servers override email address of From: header.
+        // Setting Reply-To header we avoid that user replies to the overriden address 
+        if (empty($replyto)) {
+            $mail->AddReplyTo(stripslashes($from->email), fullname($from));
+        }
     } else {
         $mail->From     = $CFG->noreplyaddress;
         $mail->FromName = fullname($from);

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to