summaryrefslogtreecommitdiff
path: root/includes/helper/email_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/helper/email_helper.php')
-rw-r--r--includes/helper/email_helper.php66
1 files changed, 45 insertions, 21 deletions
diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php
index 462b5641..dad27b39 100644
--- a/includes/helper/email_helper.php
+++ b/includes/helper/email_helper.php
@@ -1,26 +1,50 @@
<?php
-function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_its_me = false) {
- global $user;
-
- if ($not_if_its_me && $user['UID'] == $recipient_user['UID']) {
- return true;
- }
-
- gettext_locale($recipient_user['Sprache']);
-
- $message = sprintf(_("Hi %s,"), $recipient_user['Nick']) . "\n\n" . _("here is a message for you from the engelsystem:") . "\n\n" . $message . "\n\n" . _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem.");
-
- gettext_locale();
- return engelsystem_email($recipient_user['email'], $title, $message);
-}
+/**
+ * @param array $recipient_user
+ * @param string $title
+ * @param string $message
+ * @param bool $not_if_its_me
+ * @return bool
+ */
+function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_its_me = false)
+{
+ global $user;
+
+ if ($not_if_its_me && $user['UID'] == $recipient_user['UID']) {
+ return true;
+ }
+
+ gettext_locale($recipient_user['Sprache']);
+
+ $message = sprintf(_('Hi %s,'), $recipient_user['Nick']) . "\n\n"
+ . _('here is a message for you from the engelsystem:') . "\n\n"
+ . $message . "\n\n"
+ . _('This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem.');
-function engelsystem_email($address, $title, $message) {
- global $no_reply_email;
- $result = mail($address, $title, $message, sprintf("Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <%s>", $no_reply_email));
- if ($result === false) {
- engelsystem_error('Unable to send email.');
- }
+ gettext_locale();
+
+ return engelsystem_email($recipient_user['email'], $title, $message);
}
-?>
+/**
+ * @param string $address
+ * @param string $title
+ * @param string $message
+ * @return bool
+ */
+function engelsystem_email($address, $title, $message)
+{
+ $result = mail(
+ $address,
+ $title,
+ $message,
+ sprintf("Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <%s>", config('no_reply_email'))
+ );
+
+ if ($result === false) {
+ engelsystem_error('Unable to send email.');
+ }
+
+ return true;
+}