diff --git a/include/class.file.php b/include/class.file.php
index 9fdca5bee198b06307ff151db91f94076ca18b65..e5a3db128fd69ba4c5b1fb8dc79492144fdb9c0d 100644
--- a/include/class.file.php
+++ b/include/class.file.php
@@ -94,7 +94,7 @@ class AttachmentFile {
     }
 
     function getKey() {
-        return strtolower($this->ht['key']);
+        return $this->ht['key'];
     }
 
     function getSignature() {
diff --git a/include/class.mailer.php b/include/class.mailer.php
index 3db4a362331fcb7bdddf34fba415c68e6132abcd..51694795ee7995c6d357a3d89452e2cb1ac68e04 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -175,7 +175,7 @@ class Mailer {
                         return $match[0];
                     $mime->addHTMLImage($file->getData(),
                         $file->getType(), $file->getName(), false,
-                        $file->getKey().'@'.$domain);
+                        $match[1].'@'.$domain);
                     // Don't re-attach the image below
                     unset($self->attachments[$file->getId()]);
                     return $match[0].'@'.$domain;