summaryrefslogtreecommitdiff
path: root/app/Helper/MailHelper.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Helper/MailHelper.php')
-rw-r--r--app/Helper/MailHelper.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/app/Helper/MailHelper.php b/app/Helper/MailHelper.php
new file mode 100644
index 00000000..6c7eeff0
--- /dev/null
+++ b/app/Helper/MailHelper.php
@@ -0,0 +1,48 @@
+<?php
+
+namespace Kanboard\Helper;
+
+use Kanboard\Core\Base;
+
+/**
+ * Class MailHelper
+ *
+ * @package Kanboard\Helper
+ * @author Frederic Guillot
+ */
+class MailHelper extends Base
+{
+ /**
+ * Get the mailbox hash from an email address
+ *
+ * @access public
+ * @param string $email
+ * @return string
+ */
+ public function getMailboxHash($email)
+ {
+ if (! strpos($email, '@') || ! strpos($email, '+')) {
+ return '';
+ }
+
+ list($localPart, ) = explode('@', $email);
+ list(, $identifier) = explode('+', $localPart);
+
+ return $identifier;
+ }
+
+ /**
+ * Filter mail subject
+ *
+ * @access public
+ * @param string $subject
+ * @return string
+ */
+ public function filterSubject($subject)
+ {
+ $subject = str_replace('RE: ', '', $subject);
+ $subject = str_replace('FW: ', '', $subject);
+
+ return $subject;
+ }
+}