summaryrefslogtreecommitdiff
path: root/includes/helper/email_helper.php
blob: 35bdbc9adf32f450c0db2872823e4db4c47b47d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?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);
}

function engelsystem_email($address, $title, $message)
{
    $result = mail($address, $title, $message,
        "Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <noreply@engelsystem.de>");
    if ($result === false) {
        engelsystem_error('Unable to send email.');
    }
}