Subversion Repositories oidplus

Rev

Rev 1086 | Rev 1186 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1086 Rev 1116
Line 23... Line 23...
23
\defined('INSIDE_OIDPLUS') or die;
23
\defined('INSIDE_OIDPLUS') or die;
24
// phpcs:enable PSR1.Files.SideEffects
24
// phpcs:enable PSR1.Files.SideEffects
25
 
25
 
26
class OIDplusMailUtils extends OIDplusBaseClass {
26
class OIDplusMailUtils extends OIDplusBaseClass {
27
 
27
 
-
 
28
        /**
-
 
29
         * @param string $email
-
 
30
         * @return bool
-
 
31
         */
28
        public static function validMailAddress($email) {
32
        public static function validMailAddress(string $email): bool {
29
                return !empty(filter_var($email, FILTER_VALIDATE_EMAIL));
33
                return !empty(filter_var($email, FILTER_VALIDATE_EMAIL));
30
        }
34
        }
31
 
35
 
-
 
36
        /**
-
 
37
         * @param string $email
-
 
38
         * @param string $linktext
-
 
39
         * @param int $level
-
 
40
         * @return string|null
-
 
41
         */
32
        public static function secureEmailAddress($email, $linktext, $level=1) {
42
        public static function secureEmailAddress(string $email, string $linktext, int $level=1)/*: ?string*/ {
33
 
43
 
34
                // see http://www.spamspan.de/
44
                // see http://www.spamspan.de/
35
 
45
 
36
                /* Level 1 */
46
                /* Level 1 */
37
                /*
47
                /*
Line 135... Line 145...
135
                return $aus.'<noscript>'.htmlentities($linktext).' ('.htmlentities($email).')</noscript>';
145
                return $aus.'<noscript>'.htmlentities($linktext).' ('.htmlentities($email).')</noscript>';
136
 
146
 
137
                */
147
                */
138
        }
148
        }
139
 
149
 
-
 
150
        /**
-
 
151
         * @param string $to
-
 
152
         * @param string $title
-
 
153
         * @param string $msg
-
 
154
         * @param string $cc
-
 
155
         * @param string $bcc
-
 
156
         * @return void
-
 
157
         * @throws OIDplusException
-
 
158
         * @throws OIDplusMailException
-
 
159
         */
140
        public static function sendMail($to, $title, $msg, $cc='', $bcc='') {
160
        public static function sendMail(string $to, string $title, string $msg, string $cc='', string $bcc='') {
141
                $h = new \SecureMailer();
161
                $h = new \SecureMailer();
142
 
162
 
143
                // DM 14.04.2022: Added Reply-To, because some servers might change the 'From' attribute (Anti-Spoof?)
163
                // DM 14.04.2022: Added Reply-To, because some servers might change the 'From' attribute (Anti-Spoof?)
144
                $h->addHeader('From', OIDplus::config()->getValue('admin_email'));
164
                $h->addHeader('From', OIDplus::config()->getValue('admin_email'));
145
                $h->addHeader('Reply-To', OIDplus::config()->getValue('admin_email'));
165
                $h->addHeader('Reply-To', OIDplus::config()->getValue('admin_email'));