diff options
Diffstat (limited to 'core/Mail.php')
-rw-r--r-- | core/Mail.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/core/Mail.php b/core/Mail.php index 454fcd377c..192c5a94e5 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -127,6 +127,18 @@ class Mail extends Zend_Mail } } + public function createAttachment($body, $mimeType = null, $disposition = null, $encoding = null, $filename = null) + { + $filename = self::sanitiseString($filename); + return parent::createAttachment($body, $mimeType, $disposition, $encoding, $filename); + } + + public function setSubject($subject) + { + $subject = self::sanitiseString($subject); + return parent::setSubject($subject); + } + /** * @param string $email * @return string @@ -154,4 +166,18 @@ class Mail extends Zend_Mail { return isset($url['host']) && !Url::isLocalHost($url['host']); } + + /** + * Replaces characters known to appear incorrectly in some email clients + * + * @param $string + * @return mixed + */ + static public function sanitiseString($string) + { + $search = array('–', '’'); + $replace = array('-', '\''); + $string = str_replace($search, $replace, $string); + return $string; + } } |